New Posts New Posts RSS Feed: Cannot connect to database or BOS - configuration problem
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Cannot connect to database or BOS - configuration problem

 Post Reply Post Reply
Author
Randar View Drop Down
Newbie
Newbie
Avatar

Joined: 13-May-2011
Location: Toronto
Posts: 23
Post Options Post Options   Quote Randar Quote  Post ReplyReply Direct Link To This Post Topic: Cannot connect to database or BOS - configuration problem
    Posted: 13-May-2011 at 2:17pm
I have taken an existing WinForm application and trying to integrate with DevForce 2010.  The problem is, every time i try to actually get an entity, I get the following:

Key 'EntityManager_GL': The connection string for Key 'EntityManager_GL' 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 EntityManager instantiates fine, or seems as soon as I call .ToList or .FirstOrDefault, I get that error.  What I did was:

1) Created a new project that has my EDMX
2) Added a new BOS as a website on port 9009.  This has a reference to my EDM project.  Seems to load fine when I hit the EntityService.svc via a browser.
3) Added reference in my WinForm to IdeaBlade Core, EntityModel Linq and Validation and my EDM project.
4) Added the following to the App.Config for the WinForm.

  <configSections>
    <section name="ideablade.configuration" type="IdeaBlade.Core.Configuration.IdeaBladeSection, IdeaBlade.Core"/>
  </configSections>

  <connectionStrings>
    <add name="JonasNET_Entities" connectionString="metadata=res://*/GL.csdl|res://*/GL.ssdl|res://*/GL.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost\sqlExpress;Initial Catalog=XXXXX;Persist Security Info=True;User ID=XXXXXX;Password=XXXXXX;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
 
  <ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig">

    <logging logFile="DebugLog.xml"/>

    <objectServer remoteBaseURL="http://localhost" serverPort="9009" serviceName="EntityService.svc" >
      <clientSettings isDistributed="true" />
    </objectServer>

    <!-- Additional configuration can be added to override defaults.
         See the sample config files in the Learning Resources for more information.
    -->

  </ideablade.configuration>


I've tried with both isDistributed and false and get the exact same error.  I cannot figure out why it can't find the WS or my connection string.

Thoughts?  What step did I miss?
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 13-May-2011 at 3:00pm
Hi Randar;

The name of your EntityManager must match with the name in your connections string. In this case, your EntityManager name is EntityManager_GL but in your connection string, you have JonasNET_Entities.

Please let me know if this fixes the problem. You can also see this page for more discussion on how DevForce handles data source keys as well as creating a dynamic connection string.


Hope this helps.


Edited by DenisK - 13-May-2011 at 3:06pm
Back to Top
Randar View Drop Down
Newbie
Newbie
Avatar

Joined: 13-May-2011
Location: Toronto
Posts: 23
Post Options Post Options   Quote Randar Quote  Post ReplyReply Direct Link To This Post Posted: 16-May-2011 at 7:14am
Bingo, that fixed it.  Thanks for the answer and link.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 16-May-2011 at 11:22am
Sounds good. I'd like to correct one of my statements as well.

"The name of your EntityManager must match with the name in your connections string".

That is incorrect. In the generated code, there's a DataSourceKeyName attribute that is applied to the sub-typed EntityManager. And that key name is what DevForce searches in the config file for the connection string.

Sorry for the confusion.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down