Author |
Share Topic Topic Search Topic Options
|
gregweb
DevForce MVP
Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
|
Post Options
Quote Reply
Topic: No datasource key found Posted: 02-Feb-2013 at 2:06pm |
I have a Cocktail app set up using the same security structure as TempHire except I am using SQL Server.
When the LogInManager.Login() runs, it throws the error "No datasource key found for this entity type: Security.User.
Yet the datasource key appears to be set up correctly:
In the Security project, there is a App.Config with a connection string name "SecurityEntities" is configured.
The SecurityDBContext has a DataSourceKey attribute set to "SecurityEntities"
When I build the project the Build output shows the connection string is found:
Creating metadata from EntityManager 'SecurityEntities'
1> Searching for connectionString named 'SecurityEntities': found
1> Model metadata created for SecurityEntities
1> Model metadata for SecurityEntities.ibmmx is unchanged
The server log says: LoginException: Unable to login: No datasource key found for this entity type: Security.User
I am not sure what else to look for to resolve.
|
![Back to Top Back to Top](forum_images/back_to_top.png) |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 02-Feb-2013 at 2:15pm |
At runtime, DevForce will look for the connection string in the web.config, or the app.config if a 2-tier Windows/WPF app. So make sure the connection string in your Security project is also in a config used at runtime.
|
![Back to Top Back to Top](forum_images/back_to_top.png) |
gregweb
DevForce MVP
Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
|
Post Options
Quote Reply
Posted: 02-Feb-2013 at 2:34pm |
OK, checked that, and the connection string is in web.config as well:
<add name="SecurityEntities" connectionString="Data Source=.;Initial Catalog=Jet31;Integrated Security= True;MultipleActiveResultSets=True;App=Jet" providerName="System.Data.SqlClient" />
But it still throws the same error.
Edited by gregweb - 02-Feb-2013 at 2:34pm
|
![Back to Top Back to Top](forum_images/back_to_top.png) |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 02-Feb-2013 at 6:19pm |
Do you have a custom IDataSourceKeyResolver? I'm assuming not, but if so, check what it's doing. Also check that the .ibmmx is marked as an embedded resource. And finally, the debug log may have additional information on the processing preceding this error, and may prove helpful.
|
![Back to Top Back to Top](forum_images/back_to_top.png) |
gregweb
DevForce MVP
Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
|
Post Options
Quote Reply
Posted: 03-Feb-2013 at 6:45am |
Thanks Kim. Once I deleted the ibmmx file and let it regenerate, it started working. I think the issue was that I added the DbContext after the original ibmmx file was generated, so that data was missing from it.
Greg
|
![Back to Top Back to Top](forum_images/back_to_top.png) |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 03-Feb-2013 at 8:51am |
Glad you got it working. The ibmmx should automatically regenerate if any part of the model changes, including the DbContext, so we'll follow up on that to see if there's a problem.
|
![Back to Top Back to Top](forum_images/back_to_top.png) |