Ejemplo n.º 1
0
        public static tb_Notice GetLastNotice()
        {
            var notice        = new tb_Notice();
            var cacheSettable = new ShareCacheStruct <tb_Notice>();

            cacheSettable.ReLoad();

            notice = cacheSettable.Find(w => w.isStart == 1);
            if (notice == null)
            {
                SchemaTable    schema   = EntitySchemaSet.Get <tb_Notice>();
                DbBaseProvider provider = DbConnectionProvider.CreateDbProvider(schema);
                DbDataFilter   filter   = new DbDataFilter(0);
                filter.Condition = provider.FormatFilterParam("isStart");
                filter.Parameters.Add("isStart", 1);
                cacheSettable.TryRecoverFromDb(filter);//从数据库中恢复数据
                notice = cacheSettable.Find(w => w.isStart == 1);
            }
            return(notice);
        }
Ejemplo n.º 2
0
        public static void doFrom_Model_share <T>(object parm, string key = "UserID") where T : ShareEntity, new()
        {
            string typeName = typeof(T).ToString();

            ZyGames.Framework.Model.SchemaTable schema = ZyGames.Framework.Model.EntitySchemaSet.Get <T>();
            int max = int.Parse(parm as string);

            ConsoleLog.showNotifyInfo("########" + typeName + "######## From Start:" + max);
            int Step  = 1000;
            var cache = new ShareCacheStruct <T>();

            cache.ReLoad();
            for (int i = 0; i < max; i += Step)
            {
                var filter = new ZyGames.Framework.Net.DbDataFilter(0);
                filter.Condition = "where " + key + " >=@Key1 and " + key + " <@Key2";
                filter.Parameters.Add("Key1", i);
                filter.Parameters.Add("Key2", i + Step);
                cache.TryRecoverFromDb(filter);
                ConsoleLog.showNotifyInfo(typeName + ":" + i + " load");
            }
            ConsoleLog.showNotifyInfo("########" + typeName + "######## From End");
        }