3

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

1 Answer 1

5

my bad:

Map(x => x.GUID).Generated.Insert().ReadOnly(); 

works fine

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.