You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
770 B
26 lines
770 B
using Autofac;
|
|
using learun.database.mysql;
|
|
using learun.database.oracle;
|
|
using learun.database.sqlserver;
|
|
|
|
namespace learun.database
|
|
{
|
|
/// <summary>
|
|
/// 注册orm
|
|
/// </summary>
|
|
public class DbRegister
|
|
{
|
|
/// <summary>
|
|
/// 注册数据库实现类
|
|
/// </summary>
|
|
/// <param name="builder">服务构建器</param>
|
|
/// <returns>服务构建器</returns>
|
|
public static void Register(ContainerBuilder builder)
|
|
{
|
|
// 注册各个数据库实现
|
|
builder.RegisterType(typeof(SqlserverDataBase)).As(typeof(IDataBase)).Named<IDataBase>("SqlServer");
|
|
builder.RegisterType(typeof(OracleDataBase)).As(typeof(IDataBase)).Named<IDataBase>("Oracle");
|
|
builder.RegisterType(typeof(MySqlDataBase)).As(typeof(IDataBase)).Named<IDataBase>("MySql");
|
|
}
|
|
}
|
|
}
|