Print Page | Close Window

Multiple data models in single project

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2186
Printed Date: 29-Jul-2026 at 4:17am


Topic: Multiple data models in single project
Posted By: xkubr
Subject: Multiple data models in single project
Date Posted: 23-Sep-2010 at 2:47am
I am getting the below error when building my proof of concept (POC) project with multiple data models.

Type 'Poc.DataContext.EntityRelations' already defines a member called 'EntityRelations' with the same parameter types.

Scenario & additional details:
I am using VS 2010 Prof & DevForce 2010 v6.0.4.0
I have a single solution with multiple projects. I have a single project (DataContext) containing all the data models\edmx files. I need multiple data models to separate\group the entities\tables logically, e.g. Customer, Supplier, etc. will exist in one edmx file\model and lookup tables in another. When I created the second (lookups) edmx file\model and added a lookup table e.g. Country, the project did not build, with the above error because "static EntityRelations() {}" exists in both implementations of the EntityRelations partial class within both models (in the generated code). Both models implement the same EntityManager.

What am I doing wrong? Should I have all my entities in one model\edmx file? Although I think separating out the entity models is a fairly typical requirement.



Replies:
Posted By: sbelini
Date Posted: 23-Sep-2010 at 9:27am
Hi,
 
The issue you decribed has been fixed on DevForce2010 6.0.5.0.
 
You can find the latest version of DevForce on our website.


Posted By: xkubr
Date Posted: 27-Sep-2010 at 12:38am
Thank you for your reply. I have installed DevForce 2010 v6.0.5.0 and the build error does not appear.

My next problem is that I need to create an association between entities within the separate data models. How can I do this? Should I do this? Is there a sample I can refer to?

My high-level objective is to demonstrate the necessary functionality of DevFroce and follow best practice, hence my solution is a POC. With this in mind my above question still stands: Should I have all my entities in one model\edmx file?


Posted By: xkubr
Date Posted: 27-Sep-2010 at 5:14am
I have followed the suggestions made in this thread:
http://www.ideablade.com/forum/forum_posts.asp?TID=1744&title=minor-problem-using-multiple-data-models-with-the-same-entity-manager

I now have the properties manually written in the developer\partial class that is exposed. My app builds without error but when I run it I get the following error:
"The connection string for Key 'POCLOOKUPENTITIES' was not found or is invalid. Check that either a connectionStrings element or EdmKey is defined for this key in the configuration file, or implement a custom IDataSourceKeyResolver."

The error occurs when I try to create a list of the lookup table objects i.e. countries from the Lookup edmx. I currently only have one lookup table modeled. Is there any way to debug how the connection string is being read\used? And\or do I need to implement the IDataSourceKeyResolver as the error message suggests?


Posted By: sbelini
Date Posted: 04-Oct-2010 at 4:11pm
xkubr,
 
can I take a look at your App.config/Web.config file? The error leads me to believe that something might not be quite right in one of these files.
 
As for needing to implement a datasource key resolver, it's not really necessary if you have all connectionStrings or EdmKeys. (You might also take a look at our http://drc.ideablade.com/xwiki/bin/view/Documentation/BusinessObjectPersistenceAdvanced#HDataSourceKeys2CDataSourceKeyResolvers2CandDataSourceExtensions - DevForce Resource Center  section which provides details on DataSourceKeys, DataSourceKeyResolvers, and DataSourceExtensions)
 
 
 



Print Page | Close Window