private void InitEntityMetaDataCache() { foreach (var entityType in EntityTypes) { EntityMetaDataCacheType.InitTypeHandler(entityType); } }
public SmartSqlConfig Build() { if (Initialized) { return(SmartSqlConfig); } SmartSqlConfig = Parent.Build(); var sqlGen = new CUDSqlGenerator(SmartSqlConfig); foreach (var entityType in _entityTypeList) { var scope = EntityMetaDataCacheType.GetScope(entityType); if (!SmartSqlConfig.SqlMaps.TryGetValue(scope, out SqlMap sqlMap)) { sqlMap = new SqlMap { Path = entityType.AssemblyQualifiedName, Scope = scope, SmartSqlConfig = SmartSqlConfig, Statements = new Dictionary <string, Statement>(), Caches = new Dictionary <string, Configuration.Cache>(), MultipleResultMaps = new Dictionary <string, MultipleResultMap>(), ParameterMaps = new Dictionary <string, ParameterMap>(), ResultMaps = new Dictionary <string, ResultMap>() }; SmartSqlConfig.SqlMaps.Add(scope, sqlMap); } var result = sqlGen.Generate(sqlMap, entityType); foreach (var statement in result) { if (sqlMap.Statements.ContainsKey(statement.Key)) { _logger.LogDebug("{0} Exists, CUD module Skip this Statement. Continue", statement.Key); continue; } sqlMap.Statements.Add(statement.Key, statement.Value); } } Initialized = true; return(SmartSqlConfig); }
public void GetTableName() { var tableName = EntityMetaDataCacheType.GetTableName(typeof(AllPrimitive)); Assert.Equal("T_AllPrimitive", tableName); }
public GeneratorParams(SqlMap map, Type entityType) { Map = map; _entityType = EntityMetaDataCacheType.MakeGenericType(entityType); }