How to move the LINQ - dbml file to production server.
Usually we know that the dbml acts as an interface between the database and user interface for getting connected with the database.
We create the dbml file in our development system and itz quite obvious that the dbml file will directly point to our development database.
What if we move our application into to the production server there the database server will be pointing to the different location. So we need to manually write a code to point to the production database.
Here is the steps which you need to follow.
1. Open the LINQ project.
2. Open the Properties in that go to the file Settings.settings -> Settings.designer.cs file.
public string FreeFlockServiceConnectionString {
get {
//this is the place which concerns us, this is value which is auto generated
//this is auto-generated by the dbml file
// return ((string)(this["FreeFlockServiceConnectionString"]));
//create a code which point to the database from the web.config
return ((string)(System.Configuration.ConfigurationManager.ConnectionStrings["FreeFlockServiceConnectionString"].ConnectionString));
}
}
3. Create a connection string tag in the web.config which is pointing to the production server database.
What about moving dbml from one solution to another? I just added a dbml file (.dbml, .layout, .vb) from one solution to another and the .vb file part of it came over without the DataContext and I think that's the reason I can't create an instance of the DataContext class in the target solution. Trying to figure out how to resolve that.
Siva Shunmugam is a software Professional works for Effindi Technologies. He loves technology because it makes the life easy and likes socializing. By beeing a professional he comes to know about how the technology is beeing handled in the real time world. Among the many technological programes he uses and embraces SQL-SERVER, ASP.NET, JQUERY simply because he uses it in his profession.
DISCLAIMER
This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet/ BOL. My employer do not endorse any tools, applications, books, or concepts mentioned on the blog. I have documented my personal experience on this blog.
What about moving dbml from one solution to another? I just added a dbml file (.dbml, .layout, .vb) from one solution to another and the .vb file part of it came over without the DataContext and I think that's the reason I can't create an instance of the DataContext class in the target solution. Trying to figure out how to resolve that.
ReplyDelete