Thursday, October 7, 2010

RIA Tips - Domain Service Class Wizard Doesn't Find Entities

Have you ever experienced that when you try to add new Domain Service, the Domain Service Class Wizard Doesn't Find Entities? Even if you have selected a existing Entity Data Model? See the below screen.


Click to enlarge screen image

Here are some of the scenarios that lead to above situation appears.
1. You have just added the Entity Model (.edmx), but have not build your project yet. Because the Domain Service Class Wizard needs refer the CSDL, SSDL, MSL files to get the list of entities. Those files are generated from Entity Data Model when you build your project. By default those files are included in the output assembly DLL file, not visible. See here on how to do those file visible

Solution: Before adding Domain Service, build your project after yous Entity Data Model is created.

2. If you have manually created CSDL, SSDL, MSL files instead of using the Entiy Data Model Wizard that comes with Visual Studio. (See here on how to manually create Entity Data Model)

If you have created your those file manually, Domain Service Class Wizard does not know where to find those files.

3. You have generated Entity Data Model by Entity Data Model, but you set Meta Artifact Processing of you model to "Copy To Output Directory" instead of default "Embed in Output Assembly".

Solution: Set Meta Artifact Processing back to default "Embed in Output Assembly".
See my another post on how to do this

It seems that Domain Service Class Wizard only look into output assembly(BUG?).

In this case, you can see CSDL, SSDL, MSL files under your bin folder. This also cause Domain Service Class Wizard can not find the entities.

4. Visual Studio is screwed up, is working properly.

Solution: Restart Visual Studio

2 comments:

piyush23 said...

Really useful tips you have shared here and i learned a lot from this post.Register a Domain

Indian web hosting companies said...

These are the nice tips..and very useful tips..and thank you vary much for given us..good.indian web hosting companies