Entity Framework auto generate GUID

后端 未结 8 1936
离开以前
离开以前 2021-02-06 21:16

I am new to EF so here goes.I have a class which contains the following

public class EmailTemplate
{
    public Guid Id { get; set; }

    [MaxLength(2000)]
             


        
8条回答
  •  逝去的感伤
    2021-02-06 21:25

    You can also set Default Value of ID as NewID() in Sql Server itself and pass the GUID as null

    I used to do it in SSMS.

提交回复
热议问题