I am creating asp.net mvc4 sample.In this i created Id column as GUID in Sample table of datacontext.
public class Sample
{
[Required]
public Guid ID { get; set; }
[Required]
public string FirstName { get; set; }
}
This is entity table
CreateTable(
"dbo.Samples",
c => new
{
ID = c.Guid(nullable: false),
FirstName = c.String(nullable: false)
})
.PrimaryKey(t => t.ID);
Id pass 00000000-0000-0000-0000-000000000000.
How to set newid()
to GUID
and where i have to set.