I have an asp.net application developed. It uses LINQ to SQL to access database, using the .dbml designer in Visual Studio 2008. We are installing the application on client, and they have decided to change the database name on their servers. Now, the application does not work because LINQ can’t find the database information. This is not an issue with the connection strings, but with the files generated by the .dmbl designer. I suppose we have some options: 1. Change the development database name to match the client’s name, regenerate de dbml, recompile, and send the application again to client. 2. Install VS2008 on client and make the necessary modifications there.
None of the options seem really good. This is not the end of the world, but it is a real pain. I hope there’s a more reasonable solution! Any ideas?
UPDATE
After studying the problem a bit further with the help of your answers, I think the problem lies with the schema. To sum up, the database has a new name and a new schema. I suppose the sqlmetal.exe option is the best one right now. Anyways, if this is the case, I still think it’s a real pain.
I would say it Is a connection string problem, see the generated class:
Please provide more info. Perhaps you mean an schema change, in which case I strongly suggest to have it the same on the dev environment.
Update 1: Perhaps the DatabaseAttribute on the generated class confused you.
Source: http://msdn.microsoft.com/en-us/library/bb399355.aspx# (enpashis by me)
Just specify the database in the connection string, and you are good to go.
Update 2: If your generated class for some reason doesn’t has the above code (and you aren’t explicitly specifying one in the parameter), open it on the designer, open the properties, and make sure it is configured in the Connection property with Applications Settings set to truth.