I have a guid property in my entity and i want to map it to guid field in MS SQL.
public class SomeEntity
{
public virtual int Id { get; set; }
public virtual Guid GUID { get; set; }
}
and how can i map this to table and allow MS SQL generate this guid field
i've tried this
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.GUID).Unique().Not.Insert().Not.Update();
with no luck. The problem is when entity has been added it generates GUID but when i select it returns empty guid({00000000-0000-0000-0000-000000000000}).
also i've tried this
Map(x => x.GUID).Unique().ReadOnly();
again with no luck, so what is the solution? how to map to guid, which should be generated in MS SQL
my bad:
Map(x => x.GUID).Generated.Insert().ReadOnly();
works fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With