private static OrmOperateInfo GetOrmOperateCache <TType>(string conStr, string sql, string tableName, IEnumerable <PropertyInfo> prolist) { if (!prolist.Any()) { return new OrmOperateInfo() { Sql = sql, ParaFunc = null } } ; var key = $"{tableName}|{sql}|{conStr}"; var cacheInfo = OrmCacheUtil.GetCacheInfo(key); if (cacheInfo != null) { return(cacheInfo); } cacheInfo = new OrmOperateInfo { Sql = sql, ParaFunc = SqlParameterEmit.CreateDicDeleMothed <TType>(prolist) }; OrmCacheUtil.AddCacheInfo(key, cacheInfo); return(cacheInfo); }
private static OrmOperateInfo GetInsertOrmCacheInfo <TType>(string tableName, string key) { var cache = OrmCacheUtil.GetCacheInfo(key); if (cache != null) { return(cache); } cache = new OrmOperateInfo { Sql = GetInserSql <TType>(tableName, out List <PropertyInfo> prolist), ParaFunc = SqlParameterEmit.CreateDicDeleMothed <TType>(prolist) }; OrmCacheUtil.AddCacheInfo(key, cache); return(cache); }
public static void AddCacheInfo(string key, OrmOperateInfo info) { cacheList.TryAdd(key, info); }