This repository has been archived by the owner on Oct 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Provider factories
Daniel Wertheim edited this page Nov 29, 2012
·
4 revisions
SisoDb does not come with a complex generic IoC container that you will have to substitute or configure. Instead, it mostly relies on good old fashioned factories and of course also some Funcs
.
Each Db-provider has it's own IDbProviderFactory
, which creates most parts of SisoDb. To switch it out you can inject an own implementation.
public class Sql2012DbFactory : ISisoDbFactory
{
public virtual ISisoDatabase CreateDatabase(ISisoConnectionInfo connectionInfo, IDbProviderFactory providerFactory = null)
{
return new Sql2012Database(connectionInfo, providerFactory ?? new Sql2012ProviderFactory());
}
}
Either you could create one from scratch by implementing IDbProviderFactory
or extend an existing, like the Sql2012ProviderFactory
.
Please ensure you don't mess up the semantic meanings with a replacement. Have a look at the source code before switching something out for your own implementation.