Monday, October 17, 2011

Entity Framework Code First + RIA = Frustration


Did some maintenance of an existing project at work where we needed to add paging to one of our Silverlight client listviews. RIA was used but the data layer was written manually.
What a great opportunity to get some Code First (EF 4.1) training I thought, and started hacking away.

The first gotcha was that this combination wasn't really supported. Luckily for me, there was an update released (RIA Toolkit, with a DbDomainService<TContext> class) that should add support for it. Great!
Downloaded, and spent a day or so coding, making small changes in the Code First initializer to make it fit the data model etc etc. All good, let's promote!

....aaaaaargh. For some reason, our build environment could not build this thing! After a while, I figured out that the problem was that it was trying to connect to the database during build time. WTF?

More digging resulted in a post from the RIA team where they stated that currently, the RIA build step needs to do a real lookup of the datamodel. Hopefully this will be fixed in the future, but for now it meant that I had to throw away a couple of days work, and start all over again with "old" Entity Framework, which is really much more hassle if you already have both an object model and a data model (as I did).

Sigh

Again, RIA has stopped me from being productive. If it was up to me, I'd remove all RIA stuff from our projects and build a great REST API instead that can be used from any client. One of these days...

Conclusion: EntityFramwork - Great, RIA - not so great

4 comments: