This question is locked. New answers and comments are not allowed.
I need to dynamically switch connection strings depending on what setting I have in my web.config
The databases all have the exact same schema, but I want to read form different databases based on the setting connectionString
public virtual IQueryable<PurchaseOrder> GetAll()
{
var dataContext = new Minopex.GLUE.DimensionsModel(connectionString); // switch the connection string here
IQueryable<PurchaseOrder> allEntities = dataContext.GetAll<PurchaseOrder>();
return allEntities;
}
This works for simple classes with no relationships, but when I try it with on classes that have relationships, it gives me this error ...
Type is enhanced and registered, but not available from the database class meta data. This can be caused by a wrong connection id or configuration. Parameter name: type Actual value was PurchaseOrder.
Maybe I'm going about this the wrong way.
The databases all have the exact same schema, but I want to read form different databases based on the setting connectionString
public virtual IQueryable<PurchaseOrder> GetAll()
{
var dataContext = new Minopex.GLUE.DimensionsModel(connectionString); // switch the connection string here
IQueryable<PurchaseOrder> allEntities = dataContext.GetAll<PurchaseOrder>();
return allEntities;
}
This works for simple classes with no relationships, but when I try it with on classes that have relationships, it gives me this error ...
Type is enhanced and registered, but not available from the database class meta data. This can be caused by a wrong connection id or configuration. Parameter name: type Actual value was PurchaseOrder.
Maybe I'm going about this the wrong way.