Ejemplo n.º 1
0
        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);
        }