Hi All,
I have one class library project with Entity framework. while addind the Entity modal. the framework does generate the connection string in the App.config. After adding this class library in any other Win or web application. i am getting error like its not able to open the connection,after that i copied and pasted the same coonection string from the Class library project to the WinApplication,then it was working fine. so it means connection string is getting reference from the Configuration file of client application. i googled and found that it does work like that. but my requirement is i need to get the connnection string from the class library Application.
Before using the Entity Framework i had the same requirement, that i was able to do. I added the Connection string in side the settings of class library and was able to acess and was working nicely. but in Entity Framework i tried to apply the same logic and changed the modified the auto generated Partial class for EDMX. connection string is fetching from the settings of class library, but its giving error. i dont know that how It does take care. Any suggestion will be helpful for me.
Regards,
Arshad
Loading

ArshadPosted Aug 27, 2010, 11:35 AM
I am not missing the connection string reference. i am able to get the connection string, coz i have defined the connection string inside the settings of the class library. so i can access with the settings property.
Normally when we add the Data Model in the project that time it does generate the connection string with the meta data. Once i had used the entity framework with the wcf that time we also add the same connection string inside the web config file of wcf, so run time gets take care. but here i dont want that connection string to be added in the client application. i want to override the connection string in side the entity framework class,
While adding data model, it generates one partial class, that class is having the constructor with the connection string. i modified but its not able to get the reference. thats my problem.
In my very first comment also i mention, like if u will try to acess the connection string or like path of the project, it does not work with the class library. it takes the reference from the client application. for that i added the connection string in side the settings of the class library. then it was working.
Entity framwork connection string is also different, it gets generate with the meta data with the consaptual layer, data layer and mapping layer. i dont know that how entity framework acess that connection string. i googled and found that people having the same requirement like me, but they got suggestion to use the connection string in side the client application also.
Regards,
Arshad
Mahesh ChandPosted Aug 27, 2010, 10:51 AM