I'm building a Linq-to-SQL page as an experiment. I'm invoking stored procedures through Linq-to-SQL. The designer.cs
file that gets created uses the wrong DataSource
and connection string. I don't see any place to set these default values.
Right now I'm doing something stupid - I go in and manually change those two lines every time I modify the .dbml
file.
I thought, perhaps, I could do something like this:
using (TEMPDataContext dbContext = new TEMPDataContext("MyConnectionString"))
{
....
}
But that doesn't work.
Also, I'm wondering about this line from the designer.cs file:
[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="DataSource")]
Since the database is supplied in the connection string, why is this needed?