Tuesday, August 30, 2011

Regenerating RIA Domain Services and Meta Data from Entity Framework.

As you all know this is a MAJOR pain point that Microsoft needs to badly address.  It really makes you feel sick trying to use this tool without this kind of fundamental support.

Here are the issues and a way around them.

1. Entity and the edmx file doesnt pick up changes to existing entities columns and scheme correctly.  You must delete the table and import it back into your edmx file.
2. Updating a Domain Service is something you must do by hand OR regenerate and import using a compare tool.

Method we used.

1. Create a Dummy Project and add it to your solution....use a Class Project...something small and light weight.

2. Add a New Entity file ( edmx ) to your new project selecting the tables you are trying to update in your existing edmx and domain service.

3. Now Add a new Domain Service Class and this will walk you thru the Add New Domain Wizard.

4. Once this file had generated your Domain Service and Metadata classes....you now have fresh classes you can use to compare and import into your main line project you are trying to update.

Gotchas
1.  You will have to watch your name spaces and such and dont copy everything...just the metadata classes themselves.
2. Dont forget to Build right after you create or update you EDMX as you wont see the tables or changes in your Domain Wizard dialogue
3. If you are using partials to extend your main line Domain Classes this is nice because you will see these extra Metadata members using the compare tool and thus NOT delete or copy over them.


Most of the blogs I see say DO IT BY HAND and dont use the wizard which in my mind defeats the purpose of using these tools to begin with.

3 comments:

  1. This is a superb information and you have described everything very clearly and really i got a lot from this article, Thanks for spreading this information here, now i am going to bookmark this blog because i love to read this type of blogs...website hosting services

    ReplyDelete
  2. Domain services are Windows Communication Foundation (WCF) services that encapsulate the business logic of a WCF RIA Services application. A domain service exposes a set of related operations in the form of a service layer. When you define a domain service, you specify the data operations that are permitted through the domain service.
    domain and hosting services india

    ReplyDelete
  3. I like the writing structure of your blog and it does a pretty decent job of presenting the material.It’s funny how history can be twisted in so many different ways.

    indian web hosting companies

    ReplyDelete