private void InitEntityInfo <TEntity>(SqlType sqlType, int topNumber) { this.EntityInfo = er.GetEntityInfo <TEntity>(); this.ExcColums = new List <string>(); this.OrderByColums = new ConcurrentDictionary <string, string>(); this.ParamValues = new ConcurrentDictionary <string, object>(); WhereSql = " WHERE 1=1 "; SqlType = sqlType; TopNumber = topNumber; OrderBySql = ""; }
/// <summary> /// 初始化 /// </summary> /// <param name="assembly">Domain程序集用于初始化加载所有的实体映射信息</param> public static void Initialize(Assembly assembly) { var types = assembly .GetTypes() .Where(t => t.BaseType != null && (t.BaseType.GUID == typeof(BaseEntity).GUID && !t.IsGenericType)); EntityResolve er = new EntityResolve(); foreach (var type in types) { var model = er.GetEntityInfo(type); AddEntityInfo(type.FullName, model); AddTableInfo(model.TableName, model); } }