Use one model with multiple Schema
Posted: Thu 09 Aug 2012 07:57
Hi,
how can we use one generated model with multiple MySQL schemes?
We tried to get this working like described here (as it's a similar problem):
http://forums.devart.com/viewtopic.php?f=31&t=24588
After we switched the mapping mode to file, it still won't work using another schema by using a different connection string.
Here is our code so far (we are using the manifest variant described here: http://www.devart.com/linqconnect/docs/POCO.html):
It always tries to connect to the scheme we used when we created it.
The only solution that worked was to manually rename the schema in the created xml file, but we need to specify the schema in the web.config file...
how can we use one generated model with multiple MySQL schemes?
We tried to get this working like described here (as it's a similar problem):
http://forums.devart.com/viewtopic.php?f=31&t=24588
After we switched the mapping mode to file, it still won't work using another schema by using a different connection string.
Here is our code so far (we are using the manifest variant described here: http://www.devart.com/linqconnect/docs/POCO.html):
Code: Select all
Stream contextStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Samplenamespace.SampleDataContext.xml");
Devart.Data.Linq.Mapping.MappingSource mappingSource = Devart.Data.Linq.Mapping.XmlMappingSource.FromStream(contextStream);
SampleDataContext db = new SampleDataContext(WebConfigurationManager.ConnectionStrings["SampleData"].ToString(), mappingSource);
int count = db.MySampleTable.Count();
The only solution that worked was to manually rename the schema in the created xml file, but we need to specify the schema in the web.config file...