Entity Connection and Modules

Topics: Prism v4 - WPF 4
Oct 23, 2012 at 9:20 PM
Edited Oct 23, 2012 at 9:23 PM

Connection String Meta :


Errors :

After Adding Business.xModule into the Config File :

+        base    {"Unable to load the specified metadata resource."}    System.Data.EntityException {System.Data.MetadataException}

After Adding Business.xModule into the Config File :
+        base    {"Unable to resolve assembly 'Xz.Business.xModule'.":null}    System.IO.IOException {System.IO.FileNotFoundException}
xModule Info :
The Assembly Name : Business.xModule
Default Namespace : Xz.Business.xModule
Folder Locations :
Solution Folder and xModule Module Folder

Solution Location\..\x1\x2\xModule Location

Modules Location
Solution Location\..\Build

Notes :

  1. The modules have Post-Build Action which place the result assemblies into the "Build Folder"
  2. Other pieces of the config are correct.
  3. Unity, SQL CE, EF 5.0 were used.
  4. Entities are located in the DAL module and Our main module is going to use it, ( Referenced it.)

I know that Entities weren't fully supported but I think if I build this final structure I could make it work in some project lines.

Thanks in advance

Oct 24, 2012 at 4:17 PM
Edited Oct 24, 2012 at 4:50 PM


I believe that your problem could be related to how your connection string is being defined, hence I would check that the paths there are set correctly. Also, as a starting point you could check that all the dependent assemblies are copied to the "Build Folder" not only the xModule.dll. In order to ensure that these required assemblies are available to the application when the module is loaded.

Other than that, from my side, based on your previous uploaded solution I loaded the module using the Configuration File approach and set the correct path for the data source parameter to define the correct location of the database. For example I could use the following connection string without finding any errors:


    <add name="BooksContext" connectionString="metadata=res://*/BookzModel.csdl|res://*/BookzModel.ssdl|res://*/BookzModel.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&quot;data source=./../../../../Build/Modules/Books.sdf&quot;" providerName="System.Data.EntityClient" />

Take into account that as far as I know Prism does not provide guidance on this kind of configuration, for more information about ConnectionStrings you could find the following resources interesting:

Best Regards

Agustin Adami

Oct 25, 2012 at 12:18 PM

You helped me a lot, thanks