I came across a situation where I had to give my connection string in a different config file rather than the Original App.config file . I was working building a C# application using a different API where it will use a different config file generated by the framework.
I was using Entity Framework and as you know it will generate the connection string in default app.config file only.
Now I will tell you how to use this automatically generated connection string in a different file.
Copy paste the connection string to your preferred config file . Fetch the connection string value in the code. Now pass the connection string value to the constructor (which takes one parameter) in the edmx.designer.cs whenever you create an object for the data model.
I was using Entity Framework and as you know it will generate the connection string in default app.config file only.
Now I will tell you how to use this automatically generated connection string in a different file.
Copy paste the connection string to your preferred config file . Fetch the connection string value in the code. Now pass the connection string value to the constructor (which takes one parameter) in the edmx.designer.cs whenever you create an object for the data model.
Great Article
ReplyDelete.net training online | C# Online Training | Dot Net Training in Chennai | .Net Training in Chennai | ASP.NET Training | ASP.NET MVC Training | Dot Net Interview Questions| ASP.NET Training | ASP NET Training