How to autogenerate PK - Guid and other default properties in your LINQ class
partial class Invitation{
partial void OnCreated()
{
if (Id == Guid.Empty)
{
this.Id = Guid.NewGuid();
this.CreatedDate = DateTime.Now;
}
}
}
Also in this sample I am setting CreatedDate for my objects. Works fine.
Applies to all dotnet languages: C#, VB.NET, C++.NET, J#
Labels: LINQ

1 Comments:
Good words.
Post a Comment
<< Home