The second issue is that uniqueidentifier columns with the rowguid property will not work. More precisely, they will not autogenerate a value upon inserting a new row. Setting the column property to IsDbGenerated in the dbml mapping file is even worst: it will crash the insert operation. There is a workaround for this problem: in the partial class of the respective table entity, create the partial method "OnCreate" and manually set a new Guid for the new record:
partial void OnCreated()
{
if (ID == Guid.Empty) ID = Guid.NewGuid();
}
Niciun comentariu:
Trimiteți un comentariu