Beispiel #1
0
 public static SDHCGetIPublishedContentsByKeys <Key> GetIPublishContentsByIds <Key, T>(
     Func <IEnumerable <Key>, IEnumerable <IPublishedContent> > serverFunction,
     Func <IEnumerable <Key>, IDictionary <Key, T>, IEnumerable <T> > cacheFunction,
     Func <IPublishedContent, Key> getKeyFunction,
     IDictionary <Key, T> cache,
     Func <string, bool> checkQueryName,
     int expireMins = 30
     ) where T : CacheBase, new()
 {
     return((ids, where, alive, queryName) =>
     {
         var queryNameCheck = G.Text(queryName);
         if (queryNameCheck == "")
         {
             queryNameCheck = String.Join(",", ids);
         }
         var result = GetFunc.GetContentByKeys <Key, IPublishedContent, T>(
             ids, alive, serverFunction, cacheFunction, cache, getKeyFunction, expireMins, checkQueryName(queryNameCheck));
         if (where == null)
         {
             return result;
         }
         return result.Where(where);
     });
 }
Beispiel #2
0
 public static SpxusGetIContentByKey <Key> GetIContentById <Key, T>(
     Func <Key, IContent> serviceFunction, IDictionary <Key, T> cache) where T : CacheBase, new()
 {
     return((id) =>
     {
         return GetFunc.GetContentByKey <Key, IContent, T>(id, false, serviceFunction, cache);
     });
 }
Beispiel #3
0
 public static SpxusGetIContentsByString GetIContentsByContentTypeName <T>(
     Func <string, Func <IEnumerable <IContent> > > serviceFunction,
     Func <string, Func <IDictionary <int, T>, IEnumerable <T> > > cacheFunction,
     IDictionary <int, T> cache,
     Func <string, bool> checkQueryName,
     int expireMins = 30
     ) where T : CacheBase, new()
 {
     return((name, where, alive, queryName) =>
     {
         var queryNameCheck = G.Text(queryName);
         if (queryNameCheck == "")
         {
             queryNameCheck = $"Icontent Type name {name}";
         }
         return GetFunc.GetChildContentsByQuery(serviceFunction(name), cacheFunction(name), b => b.Id, cache, where, alive, expireMins, checkQueryName(queryNameCheck));
     });
 }
Beispiel #4
0
 public static SpxusGetIContentsByKey <int> GetChildIContentByRootId <T>(
     Func <int, IEnumerable <IContent> > serviceFunction,
     Func <int, IDictionary <int, T>, IEnumerable <T> > cacheFunction,
     IDictionary <int, T> cache,
     Func <string, bool> checkQueryName,
     int expireMins = 30
     ) where T : CacheBase, new()
 {
     return((rootId, where, alive, queryName) =>
     {
         var queryNameCheck = G.Text(queryName);
         if (queryNameCheck == "")
         {
             queryNameCheck = $"icontent children {G.Text(rootId)}";
         }
         return GetFunc.GetChildContentsByKey <int, IContent, T>(
             serviceFunction, cacheFunction, b => b.Id, cache, rootId, alive, expireMins, where, checkQueryName(queryNameCheck));
     });
 }
Beispiel #5
0
 public static SDHCGetIPublishedContentByString GetIPublishContentsByContentTypeName <Key, T>(
     Func <string, Func <IEnumerable <IPublishedContent> > > serviceFunction,
     Func <string, Func <IDictionary <Key, T>, IEnumerable <T> > > cacheFunction,
     Func <IPublishedContent, Key> getKeyFunction,
     IDictionary <Key, T> cache,
     Func <string, bool> checkQueryName,
     int expireMins = 30
     ) where T : CacheBase, new()
 {
     return((name, where, alive, queryName) =>
     {
         var queryNameCheck = G.Text(queryName);
         if (queryNameCheck == "")
         {
             queryNameCheck = $"documentType {name}";
         }
         return GetFunc.GetChildContentsByQuery <Key, IPublishedContent, T>(
             serviceFunction(name), cacheFunction(name), getKeyFunction, cache, where, alive, expireMins, checkQueryName(queryNameCheck));
     });
 }
Beispiel #6
0
 public static SDHCGetIPublishedContentsByKey <Key> GetChildIPublishContentByRootId <Key, T>(
     Func <Key, IEnumerable <IPublishedContent> > serviceFunction,
     Func <Key, IDictionary <Key, T>, IEnumerable <T> > cacheFunction,
     Func <IPublishedContent, Key> getKeyFunction,
     IDictionary <Key, T> cache,
     Func <string, bool> checkQueryName,
     int expireMins = 30
     ) where T : CacheBase, new()
 {
     return((rootId, where, alive, queryName) =>
     {
         var queryNameCheck = G.Text(queryName);
         if (queryNameCheck == "")
         {
             queryNameCheck = $"children {G.Text(rootId)}";
         }
         return GetFunc.GetChildContentsByKey <Key, IPublishedContent, T>(
             serviceFunction, cacheFunction, getKeyFunction, cache, rootId, alive, expireMins, where, checkQueryName(queryNameCheck));
     });
 }
Beispiel #7
0
 public static SpxusGetIContentsByKeys <int> GetIContentsByIds <T>(
     Func <IEnumerable <int>, IEnumerable <IContent> > serverFunction,
     Func <IEnumerable <int>, IDictionary <int, T>, IEnumerable <T> > cacheFunction,
     IDictionary <int, T> cache,
     Func <string, bool> checkQueryName,
     int expireMins = 30
     ) where T : CacheBase, new()
 {
     return((ids, where, alive, queryName) =>
     {
         var queryNameCheck = G.Text(queryName);
         if (queryNameCheck == "")
         {
             queryNameCheck = $"Ids content {String.Join(",", ids)}";
         }
         var result = GetFunc.GetContentByKeys <int, IContent, T>(ids, alive, serverFunction, cacheFunction, cache, b => b.Id, expireMins, checkQueryName(queryNameCheck));
         if (where == null)
         {
             return result;
         }
         return result.Where(where);
     });
 }