Can I use RIA Services with Entity Framework 4.3?

安稳与你 提交于 2019-12-10 16:13:14

问题


This is my setup: MVC app A domain model with a data access layer using Enitity Framework Code First Silverlight application (displayed in the MVC App)

I'm using RIA Service to make the Silverlight App interact with the DB.

Ria services only supports entity framework 4.1 as of now. Current release is 4.3. Seems to be a waste to not get the new features of EF (like migrations and hopefully enum support in the future) just becouse of the Ria service for the Silverlight app.

My question is therefore:

  1. Is it reasonable to rely on the Ria Service when using EF code first (i.e. will they always lag behind by so much? Could this be a problem down the road?)
  2. Do you have an alternative solution where the Silverlight app is not so dependent on what version of the ORM i use?

回答1:


RIA Services can be used with NHibernate or any other ORM or object/domain model. Only some of the VS Wizards imply there is coupling between EF and RIA Services, but you clearly aren't required to use those wizards nor is there a coupling between EF and RIA Services.

The answer to the question "Can I use RIA Services with Entity Framework 4.3?" is absolutely yes.

OData is an alternative to RIA Services, but it has quite a few limitations and is not intended as a direct competitor. WCF is also an alternative.




回答2:


A workaround for getting migrations before RIA services properly supports EF4.3 could also be to create a project solely for migrations, similar in spirit to the database projects in Visual Studio Ultimate.

The model would need to be included by such a project via "add as link" and you'd need to make sure that it can compile in both projects. For example, you might need to define some dummy attribute that are defined in RIA-Services ("Include" would be one).

It's not ideal but maybe it's the best option in some cases.




回答3:


To get a temporary workaround for the lock of version < 4.2 of the RiaServices.EntityFramework NuGet package, I've used the NuGet Package Explorer in order to change the metadata of the package and removed the constraint.

Remeber you must add the local cache as NuGet source.

Tools -> Options -> Package Manager -> Package Sources -> Add (C:/Users/%username%/Appdata/Local/Nuget/Cache)



来源:https://stackoverflow.com/questions/9302931/can-i-use-ria-services-with-entity-framework-4-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!