using Autofac; using learun.database.mysql; using learun.database.oracle; using learun.database.sqlserver; namespace learun.database { /// /// 注册orm /// public class DbRegister { /// /// 注册数据库实现类 /// /// 服务构建器 /// 服务构建器 public static void Register(ContainerBuilder builder) { // 注册各个数据库实现 builder.RegisterType(typeof(SqlserverDataBase)).As(typeof(IDataBase)).Named("SqlServer"); builder.RegisterType(typeof(OracleDataBase)).As(typeof(IDataBase)).Named("Oracle"); builder.RegisterType(typeof(MySqlDataBase)).As(typeof(IDataBase)).Named("MySql"); } } }