Database default value assignment problem

5 posts, 1 answers
  1. John
    John avatar
    17 posts
    Member since:
    Aug 2014

    Posted 19 Oct 2014 Link to this post

    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



  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 21 Oct 2014 Link to this post

    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
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. John
    John avatar
    17 posts
    Member since:
    Aug 2014

    Posted 21 Oct 2014 in reply to Thomas Link to this post

    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
  5. Answer
    Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 24 Oct 2014 Link to this post

    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
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  6. John
    John avatar
    17 posts
    Member since:
    Aug 2014

    Posted 24 Oct 2014 in reply to Thomas Link to this post

    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
Back to Top
DevCraft banner