Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Federico Gerardo Rafael Báez Petrocelli fgbaezp

🦀
View GitHub Profile
@fgbaezp
fgbaezp / Apphost.cs
Created Jan 22, 2020
ServiceStack multiple db connections
View Apphost.cs
container.Register<IDbConnectionFactory>(
c => {
OrmLiteConnectionFactory dbFactory = new OrmLiteConnectionFactory(ConfigurationManager.ConnectionStrings["usuarios"].ConnectionString, SqlServerDialect.Provider)
{
ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current)
};
dbFactory.RegisterConnection("AnotherDB", ConfigurationManager.ConnectionStrings["Another"].ConnectionString, SqlServerDialect.Provider);
return dbFactory;
}