Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 10, 2012 01:28 AM by Decker Dong - MSFT
Member
53 Points
24 Posts
Dec 09, 2012 08:38 AM|LINK
Hi,
How to create the auto generated column (Identity column) in Datacontext?
[Column(IsPrimaryKey = true, IsDbGenerated = true)] public int iReportID { get; set; } [Column(IsPrimaryKey = false, IsDbGenerated = true)] public int iItemID { get; set; }
All-Star
118619 Points
18779 Posts
Dec 10, 2012 01:28 AM|LINK
If you are using EF (Code-first), please add this property:
DatabaseGenerated(DatabaseGeneratedOption.Identity)
Else you must do setting for the "DefaultValue" in the db in your SQL Management Studio.
Reguards!
thava
Member
53 Points
24 Posts
auto generated column (Identity column) in Datacontext?
Dec 09, 2012 08:38 AM|LINK
Hi,
How to create the auto generated column (Identity column) in Datacontext?
[Column(IsPrimaryKey = true, IsDbGenerated = true)] public int iReportID { get; set; } [Column(IsPrimaryKey = false, IsDbGenerated = true)] public int iItemID { get; set; }Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: auto generated column (Identity column) in Datacontext?
Dec 10, 2012 01:28 AM|LINK
Hi,
If you are using EF (Code-first), please add this property:
DatabaseGenerated(DatabaseGeneratedOption.Identity)
Else you must do setting for the "DefaultValue" in the db in your SQL Management Studio.
Reguards!