简体   繁体   中英

Entity Framework database first and RIA services navigation properties

I've inherited a Silverlight and RIA services project and it uses an EF4, database first DAL.

In the past when I used RIA services (the only other time I used it) it was with NHibernate so we had to mark all the entities with the appropriate [Association] and [Include] attributes. This meant that our navigation properties were available in the Silverlight client application.

At the time, I was under the impression that if we'd used Entity Framework instead of NHibernate, the generated EF model classes would be marked up with attributes that were not exactly [Association] and [Include] but were equivalent.

It appears that this isn't the case, my navigation properties for my model aren't available in the Silverlight client. Do I need to use metadata classes and add the [Association] properties manually to all the classes that require them?

Thanks,

Ben

My Navigation properties were not present in the client side models because there was a metadata class for the entity which I was using but it only contained one property.

The navigation property wasn't specified in the metadata class so wasn't available on the client.

The moral of the story is, you can't do "partial" metadata classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM