Beispiel #1
0
        protected BaseService(IServiceConstructor <T> constructor)
        {
            CurrentUsername          = constructor.Username;
            Context                  = constructor.Context;
            IsSharedContext          = constructor.IsSharedContext;
            Repo                     = new GenericRepository <T, SqlParameter, int>(this.Context, CurrentUsername);
            CacheContainer           = constructor.CacheContainer;
            cacheLoadFilter          = constructor.CacheLoadFilter;
            cacheTimeoutInMinutes    = constructor.CacheTimoutInMinutes;
            includePropertiesInCache = constructor.IncludePropertiesInCache;
            reloadMethod             = async(context) =>
            {
                IGenericRepository <T, int> repo = new GenericRepository <T, SqlParameter, int>(context, "System");

                var data = await repo.GetAsync(cacheLoadFilter, includePropertiesInCache);

                var detachedData = data.Select(t => repo.CreateDetachedEntity(t)).ToList();
                return(detachedData);
            };
        }