Inheritance and HasContraint via Fluent API

Thread is closed for posting
2 posts, 0 answers
  1. Greg
    Greg avatar
    11 posts
    Member since:
    Aug 2014

    Posted 05 Aug 2014 Link to this post


    I'm fairly new to using Telerik Data Access and I tried searching for this exact issue in the forum but didn't find it. I am trying to set up a 1:1 relationship on an entity that is using vertical inheritance, however, when I try to add the constraint I get the following error:

    The property Id is not mapped to a column. (Id is my primary key.)

    Parent class mapping

    parentConfig.HasProperty(t => t.Id)

    Inherited/child mapping

    childConfig.HasAssociation(t => t.ChildAssociation)
       .HasConstraint((c, l) => c.Id == l.Id) --This is causing the issue


    Association mapping

    associationConfig.HasProperty(t => t.Id)

    It seems that since the Id property is mapped on the parent type, the HasConstraint method doesn't recognize it on the derived type. I did manage to get a 1:1 relationship setup on two classes that have no inheritance mapping. Is there a workaround for this or is there something I am missing? Thanks.

  2. Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 07 Aug 2014 Link to this post

    Hi Greg,

    I am afraid that the behavior you are experiencing is a known issue on our side and unfortunately there isn't any workaround for this problem. I could only recommend you to change the design of your model. 

    Please excuse us for the inconvenience caused.

    Do not hesitate to contact us if you have any more questions or need any further assistance. 

    Boris Georgiev
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top