WCF DataService Incomplete Metadata

11 posts, 0 answers
  1. Samuel
    Samuel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 04 Sep 2013 Link to this post

    I have used Fluent to generate my model and map with the database.

    I have a 1-to-many association between a Mandate which holds a collection of OpenPosition entities. Note that on OpenPosition I have a foreign key to Mandate and in the model it is decorated with the ForeignKeyAssociation Attribute.


    Then I use a WCF DataService for sending data to the client. But the metadata generated is incomplete. See :

    <Association Name="OpenPosition_Mandate_Mandate_OpenPositions">
    <
    End Type="DirectDebitModel.Mandate" Multiplicity="0..1" Role="Mandate_OpenPositions"/>
    <
    End Type="DirectDebitModel.OpenPosition" Multiplicity="*" Role="OpenPosition_Mandate"/>
    </
    Association>

    <
    EntityContainer Name="FluentModel" m:IsDefaultEntityContainer="true">
    <
    EntitySet Name="OpenPositions" EntityType="DirectDebitModel.OpenPosition"/>
    <
    EntitySet Name="Mandates" EntityType="DirectDebitModel.Mandate"/>
    <
    AssociationSet Name="OpenPosition_Mandate" Association="DirectDebitModel.OpenPosition_Mandate_Mandate_OpenPositions">
    <
    End Role="OpenPosition_Mandate" EntitySet="OpenPositions"/>
    <
    End Role="Mandate_OpenPositions" EntitySet="Mandates"/>
    </
    AssociationSet>
    </
    EntityContainer>


       The referentialConstraint node inside the Association node is missing ! Normally this is generated when the .HasForeignKey() method is used in the Fluent model (with EntityFramework). I haven't found such a method in the OpenAccess API. But I thought that the ForeignKeyAssociation attribute would be enough.

    Telerik openaccess data service implementation seems to ignore completely this feature.

    Is this a missing feature or am I doing something wrong ? 

  2. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    71 posts
    Member since:
    Mar 2013

    Posted 05 Sep 2013 Link to this post

    Hi Samuel,

    The ReferentialConstraint node in the metadata of services based on EF is a side effect of the metadata provider they use. In general this node is not part of the oData metadata officially. You could check this with some of the sample services like this one.
    Also most of the clients do not respect this node, that's why our service metadata provider do not generate this node.  

    Do you face any issues because of the missing node? If you do we can try to find a way how workaround it.

    I hope this helps. Please do not hesitate to get back to us with any questions. 
     

    Regards,
    Kaloyan Nikolov
    Telerik
    OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.

  3. Samuel
    Samuel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 05 Sep 2013 Link to this post

    Hi,

    Thanks for you reply. I hope you can help me. Actually, ReferentialConstraint IS part of the official ODATA specification since V3. See this link:

    http://www.odata.org/documentation/odata-v3-documentation/common-schema-definition-language-csdl/#104_The_edmReferentialConstraint_Element


    The thing is that I desperately need this node to be part of the metadata, because I use breezejs on the client side to help with data management in JavaScript and this library relies on the referential constraint node to  build navigation properties.

    So far I've been unsuccessful at adding this node to the metadata using OpenAccess (works fine with EF but my company uses OpenAccess).  Do you think you could help  ?

  4. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    71 posts
    Member since:
    Mar 2013

    Posted 05 Sep 2013 Link to this post

    Hello Samuel,

    We use a custom implementation of the IDataServiceMetadataProvider interface to produce the metadata needed. The property we should set in order to get this element is ResourceAssociationType.ReferentialConstraint is internal and unfortunately we don't have access to it. It seems that only Microsoft is able to produce this metadata easily. You probably could use reflection to set those internal members but this will not guarantee that it will work in the next version. We cannot support this approach out of the box.

    We will try to find better way to deal with the situation. I'll let you know when we have more information.
     

    Regards,
    Kaloyan Nikolov
    Telerik
    OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.

  5. Samuel
    Samuel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 05 Sep 2013 Link to this post

    Is it not on  AssociationType  which is part of AssociationType.ReferentialConstraint rather ? I couldn't find a ReferentialConstraint on ResourceAssociationType. Not that it makes a difference anyway.
    Do you think you can come up with a solution for me  ?  

  6. Ivailo
    Admin
    Ivailo avatar
    316 posts
    Member since:
    Sep 2012

    Posted 06 Sep 2013 Link to this post

    Hello Samuel,

    We will probably have to find a way to support this element anyway, since it would make our oData support better and more feature complete. At this point we are still unsure what would be the best way to tackle the limitation Microsoft has imposed, but we will work on that during the next few days and we will let you know once we have a solution or a workaround that can be applied on your side.


    Regards,

    Ivailo
    Telerik
    OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.

  7. Samuel
    Samuel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 24 Sep 2013 Link to this post

    Hello,

    Could I have an update on this? Have you found a workaround for adding the missing node to the metadata ?

    Thanks

  8. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    174 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2013 Link to this post

    Hi Samuel,

    So far we have not found a way to set the metadata that you are looking for and there will be no changes in behaviour for the upcoming Q3 2013 release.
    I am not sure if we will be able to implement this in the future. Given the limitations of the API that Microsoft have imposed I do not see a way to overcome this issue even given the source code of the OpenAccessMetadataProvider.

    I am sorry for the inconvenience. If there is any progress that can resolve the issue you are experiencing I will make sure to contact you with the latest information.

    Regards,
    Viktor Zhivkov
    Telerik

    OpenAccess ORM Q3 2013 Beta is available for immediate download in your account. Get it now and play with the latest bits. See what's new >>

  9. shail
    shail avatar
    3 posts
    Member since:
    Jul 2014

    Posted 14 Jul Link to this post

    When refreshing data that is persisted, the OnPropertyChanged event is raised for every property in every data object, this can cause a lot of slowdown

  10. shail
    shail avatar
    3 posts
    Member since:
    Jul 2014

    Posted 16 Jul in reply to Viktor Zhivkov Link to this post

    As companies begin to implement new Web-based information systems, <a href=http://www.dotlovesdata.com/>Data Analysis</a> technology must satisfy complex new scenarios. Whereas a  of applications accessed data  on the mainframe, now developers building Web-based applications need access to data distributed throughout their organization — on different hardware platforms, different operating systems, and data stores.

  11. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    71 posts
    Member since:
    Mar 2013

    Posted 17 Jul Link to this post

    Hello Shail,

    In order to assist you could you describe in more details your scenario. What do you mean by "refreshing data"? What kind of application you refer, is this a service as the current thread is bound to service issues?


    Regards,
    Kaloyan Nikolov
    Telerik

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

Back to Top