views:

178

answers:

1

I want to add a new domain service class within vs2010. I choose my entity framework database context in the dialog "Add New Domain Service Class", but it doesen't show me the available entities. If I click "ok" VS2010 gives me the following error message:

---------------------------
Microsoft Visual Studio
---------------------------
Value cannot be null.

Parameter name: ssdlPath
---------------------------
OK   
---------------------------

The reason for this is, that I don't have an EDMX file (I tried it with an EDMX file and it worked). Instead I have a seperate csdl, msl and ssdl file. This is because I want to support multiple databases.

How can I use the class LinqToEntitiesDomainService with my data context? The entity objects and the data context are generated with the POCO template. If I add the Domain Serive class manually (not using the domain service wizzard) I get a compile time error which says basically the same:

MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Ria.Client.targets(303,5): error : Value cannot be null.
MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Ria.Client.targets(303,5): error : Parameter name: ssdlPath

Can anyone help?

+1  A: 

Select YorDoaminContainer.csdl,YorDoaminContainer.ssdl file and the YorDoaminContainer.msl file and then In Properties, set Build Action to Embedded Resource. And then make sure you have correct connection string for this three resources.

for example:

<connectionStrings>
    <add name="DomainModel" 
         connectionString="metadata=res://*/NameSpace.DomainController.csdl|res://*/NameSpace.DomainController.ssdl|res://*/NameSpace.DomainController.msl;
         provider=System.Data.SqlClient;provider connection string='Data Source=localhost;
         Initial Catalog=DB;Integrated Security=True;Connection Timeout=60;
         providerName="System.Data.EntityClient" />
</connectionStrings>
Mostafa
If you have one of the three, you'll need to make sure they are all embedded or you'll see an ArgumentNullException csdlPath, ssdlPath, or mslPath respectively.
Kyle McClellan
Thanks for the response. I have the build action set to "Embedded Resource" for all three files. Does the filename play a role? The filenames are like follows: DomainController.csdl, DomainController.msl and DomainController.Oracle.ssdl. I have put them in a subfolder called "Model"
Jeho, I updated the answer.
Mostafa
Thanks again, Mostafa. But I have a working connection string. I can tell that, because I have no problem instancing and using my entity domain context inside the DomianService class (and that's waht I'm currently doing). Besides of that, I get a compile time error (not a runtime error).