Hi sgillbee,
If you don't have a database to connect to, you don't really need a connection string.
As smi-mark suggested, the CompositionContext might be what you are looking for.
You "connect" to a context when the entity manager is constructed (and therefore manage your "connections" programatically). You can have multiple entity managers "connected" to different contexts (you will need to implement a ICompositionContextResolver):
public class CompositionContextResolver : BaseCompositionContextResolver {
public static CompositionContext Mock1 = CompositionContext.Default
.WithGenerator(typeof(MockEntityServerQueryInterceptor))
.WithGenerator(typeof(MockEntityServerSaveInterceptor));
.WithName("Mock1");
public static CompositionContext Mock2 = CompositionContext.Default
.WithGenerator(typeof(MockEntityServerQueryInterceptor))
.WithGenerator(typeof(MockEntityServerSaveInterceptor))
.WithName("Mock2");
}
[PartNotDiscoverable]
public class MockEntityServerQueryInterceptor : EntityServerQueryInterceptor {
protected override bool ExecuteQuery() {
throw new InvalidOperationException();
}
}
[PartNotDiscoverable]
public class MockEntityServerSaveInterceptor : EntityServerSaveInterceptor {
protected override bool ExecuteSave() {
throw new InvalidOperationException();
}
}
###############################################################
var em1 = new NorthwindIBEntityManager(compositionContextName: CompositionContextResolver.Mock1.Name);
var em2 = new NorthwindIBEntityManager(compositionContextName: CompositionContextResolver.Mock2.Name);
Could you clarify why you need the connection string, so I can better understand your issue and try to find any existing alternative solutions? (what are you trying to connect to?)
Regards,
Silvio.