Multiple connection strings?
Posted: Tue 12 Jul 2011 00:16
I have a web project with same code base but different contents. I used to have a configuration manager that parses the domain name, and initiates the respective connection string + site configuration into the context.
Now I'm using devart on my project but I could not find a way to initiate the Devart Entities context using it's default constructor.
When I design my classes, the Designer.cs file has this:
when I want to create different contexts using the second constructor(using connectionstring) it gives me error saying that my connection string is not valid (which is valid) , and If I could connect, I'm not sure how to override the second parameter (defaultContainerName).
Is there a way to get more than one connection/context using devart and override this code that was generated?
Any clues?
Now I'm using devart on my project but I could not find a way to initiate the Devart Entities context using it's default constructor.
When I design my classes, the Designer.cs file has this:
Code: Select all
public DataEntities() :
base(@"[email protected]", "DataEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
}
///
/// Initializes a new DataEntities object using the connection string found in the 'DataEntities' section of the application configuration file.
///
public DataEntities(string connectionString) :
base(connectionString, "DataEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
}
///
/// Initialize a new DataEntities object.
///
public DataEntities(EntityConnection connection) : base(connection, "DataEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
}
Is there a way to get more than one connection/context using devart and override this code that was generated?
Any clues?