This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to insert an object having the database supply the default for the columns with unspecified values. For the table in question, the proper fields are all have their HasDefaultValue and IsNullable as true on the meta-column and Nullable=True in the Domain Class's property. During the SaveChanges, however, I see all of the fields in the insert statement. Is there something else I'm missing?
John
I'm trying to insert an object having the database supply the default for the columns with unspecified values. For the table in question, the proper fields are all have their HasDefaultValue and IsNullable as true on the meta-column and Nullable=True in the Domain Class's property. During the SaveChanges, however, I see all of the fields in the insert statement. Is there something else I'm missing?
John
4 Answers, 1 is accepted
0
Currently we do not support default values from the database side; you will need to resort storing the same value from the client side instead.
Regards,
Thomas
Telerik
Regards,
Thomas
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0
John
Top achievements
Rank 1
Iron
answered on 21 Oct 2014, 11:50 AM
Thanks Thomas
If this is the case, what functionality this link is referred to http://docs.telerik.com/data-access/developers-guide/data-access-domain-model/domain-class-mapping/data-access-tasks-define-model-class-mapping-default-values
Regards, John
If this is the case, what functionality this link is referred to http://docs.telerik.com/data-access/developers-guide/data-access-domain-model/domain-class-mapping/data-access-tasks-define-model-class-mapping-default-values
Regards, John
0
Accepted
Hi John,
my mistake, didn't remember that we implemented that. I tried this here with a string column where I specified in the fluent mapping .HasDefaultValue(). This worked, and the column was omitted from the insert statement.
Which mapping are you using?
Regards,
Thomas
Telerik
my mistake, didn't remember that we implemented that. I tried this here with a string column where I specified in the fluent mapping .HasDefaultValue(). This worked, and the column was omitted from the insert statement.
Which mapping are you using?
Regards,
Thomas
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0
John
Top achievements
Rank 1
Iron
answered on 24 Oct 2014, 02:44 PM
I used a database-first to start the model, although to expedite things, I've messed with the rlink file directly which worked for most part but I could have screwed something up. Also, upon further review, it turned out we can't use the database defaults the way they are implemented since null values carry a significance for the application. Thanks for your response though.
Regards, John
Regards, John