4
votes

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?
3
What about just using a WCF abstraction layer? If you pick ria services you are going to try your hands.O.O
That's what I fear. What seems to be a quick and simple solution in the start can cause major pain later on. I use SL for showing/creating reports and use I use the Telerik RAD controls for functions that I need to implement but does not need to be accessed by others than admins => spend as little time on them as possible, but still efficient to use. RIA allows me to pretty much just scaffold the methods, and go and bind it to a control in a SL view. Would it be possible to do the same with WCF? Would you publish the WCF on IIS?cfs
The way I see it, RIA is the quick/dirty small app convenient way of building a silverlight application. Reminds me of drag and dropping datasets from the designer. You might look into WCF Data Services or stackoverflow.com/questions/2523629/…O.O

3 Answers

4
votes

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.

0
votes

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.

0
votes

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)