public static IServiceCollection AddAriesEntities(this IServiceCollection services, params Type[] types) { if (FreeSqlHandler == default) { throw new System.Exception("请优先注册 AriesFreeSql : services.AddAriesFreeSql(type,conn)"); } TableInfomation.InitializeTypes(FreeSqlHandler, types); return(services); }
public static IServiceCollection AddAriesFreeSql(this IServiceCollection services, DataType sqlType, string connectionString, Action <IFreeSql> callBack = null) { FreeSqlHandler = new FreeSql.FreeSqlBuilder() .UseConnectionString(sqlType, connectionString) .Build(); callBack?.Invoke(FreeSqlHandler); services.AddSingleton(FreeSqlHandler); TableInfomation.InitializeTypes(FreeSqlHandler, typeof(AriesOptimisticLockModel)); return(services); }