The ConnectionString property has not been initialized. WCF Service

Posts   
 
    
Posts: 16
Joined: 11-May-2010
# Posted on: 29-Nov-2010 09:08:00   

I have this WCF Service that is calling this method of an object that is placed in a different assembly. The latest actually fecthes all the data for the webservice.

I am getting this when I call the Fetch Method on the adapter (using the WcfTestClient):

The ConnectionString property has not been initialized.

I have the connection string set in the app.config of the DBSpecific Library:

<?xml version="1.0"?>
<configuration>
    <appSettings>
    <add key="Main.ConnectionString" value="data source=yyy;initial catalog=xxx;Integrated Security=True;persist security info=False;packet size=4096" />
    </appSettings>
</configuration>

and on the WCF site web.config file:

<connectionStrings>
    <remove name="Main.ConnectionString"/>
    <add name="Main.ConnectionString" connectionString="data source=yyy;initial catalog=xxx;Integrated Security=True;persist security info=False;packet size=4096" providerName="System.Data.SqlClient" />
  </connectionStrings>

ail I even tried to insert an app.config in the BusinessObject Assembly but to no avail (as expected).

Anyone has any idea on this? Thanks for your help

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Nov-2010 09:28:45   

I'm a little bit confused as to where the adapter is used, in the WCF service or in the TestClient?

Posts: 16
Joined: 11-May-2010
# Posted on: 29-Nov-2010 11:31:43   

Sorry this is a bit confusing:

So I have my BusinessLogic Assembly with my BLL classes one of them my CustomerBLL class with this method:

public EntityCollection<CustomerEntity> GetAll()
{
EntityCollection<CustomerEntity> customers = new EntityCollection<CustomerEntity>();

using(DataAccessAdapter adapter = new DataAccessAdapter())
{
    adapter.FetchEntityCollection(customers);
}
return customers;
}

Then on the service implementation:

public IEntityCollection2 GetCustomers()
    {
   CustomerBLL cbl = new    CustomerBLL ()  
    return bll.GetAll();
    }

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 29-Nov-2010 14:48:54   

And the WCF service is hoted in a webSite? If so, then the con.String set in that website web.config should be enough.

Could you please make sure the connectionString key name is exactly the same as the one in the LLBLGen Project Properties. (check it in the LLBLGen Designer).

Posts: 16
Joined: 11-May-2010
# Posted on: 30-Nov-2010 01:02:56   

Thanks Walaa,

So it was being set with the default pattern in the LLBGen Designer Project Properties. I changed it to: "Main.ConnectionString" and it worked

Thanks Again