/// <summary> /// 从服务端查询 /// </summary> /// <param name="expression"></param> /// <param name="total"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> List <TModel> QueryFromCacheServer(Expression <Func <TModel, bool> > expression, out int total, int pageIndex = 0, int pageSize = 0) { var proxy = CacheServerSetting.GetCurrentClient(typeof(TModel)); if (proxy == null) { throw new Exception("未在服务器上找到对应的数据处理类型:" + typeof(TModel).FullName); } var data = proxy.Query(expression, out total, pageIndex, pageSize); return(data); }
void NotifyCacheServer <TItem>(TItem newObj) where TItem : IModel { if (!OnUpdateNotifyCacheServer) { return; } var client = CacheServerSetting.GetCurrentClient(typeof(TItem)); if (client != null) { client.Update(newObj); } }
/// <summary> /// 通知缓存服务器 /// </summary> /// <typeparam name="TItem"></typeparam> /// <param name="newObj"></param> void NotifyCacheServer <TItem>(TItem newObj) where TItem : IModel { if (!OnUpdateNotifyCacheServer) { return; } System.Threading.Tasks.Task.Run(() => { var client = CacheServerSetting.GetCurrentClient(typeof(TItem)); if (client != null) { client.Update(newObj); } }); }
/// <summary> /// 通知缓存服务器 /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="newObj"></param> void NotifyCacheServer <TModel>(TModel newObj) where TModel : IModel { if (DataBaseArchitecture == CRL.DataBaseArchitecture.NotRelation) { //非关系型没有缓存 return; } if (!OnUpdateNotifyCacheServer) { return; } var client = CacheServerSetting.GetCurrentClient(typeof(TModel)); if (client != null) { client.Update(newObj); } }