public Csla.Server.DataPortalResult Update(object obj, Csla.Server.DataPortalContext context)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(obj.GetType());

            proxy = GetDataPortalProxy();
            return proxy.Update(obj, context);
        }
        public Csla.Server.DataPortalResult Delete(Type objectType, object criteria, Csla.Server.DataPortalContext context)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(objectType);

            proxy = GetDataPortalProxy();
            return proxy.Delete(objectType, criteria, context);
        }
コード例 #3
0
        public async Task <DataPortalResult> Delete(Type objectType, object criteria, Csla.Server.DataPortalContext context, bool isSync)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(objectType);

            proxy = GetDataPortalProxy();
            return(await proxy.Delete(objectType, criteria, context, isSync));
        }
コード例 #4
0
        public Csla.Server.DataPortalResult Delete(Type objectType, object criteria, Csla.Server.DataPortalContext context)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(objectType);

            proxy = GetDataPortalProxy();
            return(proxy.Delete(objectType, criteria, context));
        }
コード例 #5
0
        public async Task <DataPortalResult> Update(object obj, Csla.Server.DataPortalContext context, bool isSync)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(obj.GetType());

            proxy = GetDataPortalProxy();
            return(await proxy.Update(obj, context, isSync));
        }
コード例 #6
0
        public Csla.Server.DataPortalResult Update(object obj, Csla.Server.DataPortalContext context)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(obj.GetType());

            proxy = GetDataPortalProxy();
            return(proxy.Update(obj, context));
        }
        public async Task<DataPortalResult> Delete(Type objectType, object criteria, Csla.Server.DataPortalContext context, bool isSync)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(objectType);

            proxy = GetDataPortalProxy();
            return await proxy.Delete(objectType, criteria, context, isSync);
        }
        public async Task<DataPortalResult> Update(object obj, Csla.Server.DataPortalContext context, bool isSync)
        {
            //evict cache items based on ObjectCacheEvictionAttribute
            RemoveCacheItems(obj.GetType());

            proxy = GetDataPortalProxy();
            return await proxy.Update(obj, context, isSync);
        }
コード例 #9
0
        public async Task <DataPortalResult> Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
        {
            var cachingAttribute = ObjectCacheAttribute.GetObjectCacheAttribute(objectType);
            var cacheProvider    = CacheManager.GetCacheProvider();

            if (cachingAttribute != null && cacheProvider != null)
            {
                //get scenario details
                var scope           = cachingAttribute.Scope;
                var cacheByCriteria = cachingAttribute.CacheByCriteria;
                var expiration      = cachingAttribute.Expiration;

                //get key
                var key = GetCacheItemKey(objectType, cachingAttribute);

                //include criteria hash if needed
                if (cachingAttribute.CacheByCriteria)
                {
                    key = string.Format("{0}::{1}", key, criteria.GetHashCode());
                }

                var data = cacheProvider.Get(key);
                if (data == null)
                {
                    //cache miss
                    proxy = GetDataPortalProxy();
                    var results = await proxy.Fetch(objectType, criteria, context, isSync);

                    if (expiration > 0)
                    {
                        cacheProvider.Put(key, results.ReturnObject, new TimeSpan(0, expiration, 0));
                    }
                    else
                    {
                        cacheProvider.Put(key, results.ReturnObject);
                    }

                    return(results);
                }
                else
                {
                    //cache hit
#if !NET45 && !NET46
                    await TaskEx.Delay(0);
#else
                    await Task.Delay(0);
#endif
                    return(new DataPortalResult(data));
                }
            }
            else
            {
                proxy = GetDataPortalProxy();
                return(await proxy.Fetch(objectType, criteria, context, isSync));
            }
        }
コード例 #10
0
        public DataPortalResult Fetch(Type objectType, object criteria, DataPortalContext context)
        {
            var cachingAttribute = ObjectCacheAttribute.GetObjectCacheAttribute(objectType);
            var cacheProvider    = CacheManager.GetCacheProvider();

            if (cachingAttribute != null && cacheProvider != null)
            {
                //get scenario details
                var scope           = cachingAttribute.Scope;
                var cacheByCriteria = cachingAttribute.CacheByCriteria;
                var expiration      = cachingAttribute.Expiration;

                //get key
                var key = GetCacheItemKey(objectType, cachingAttribute);

                //include criteria hash if needed
                if (cachingAttribute.CacheByCriteria)
                {
                    key = string.Format("{0}::{1}", key, criteria.GetHashCode());
                }

                var data = cacheProvider.Get(key);
                if (data == null)
                {
                    //cache miss
                    proxy = GetDataPortalProxy();
                    var results = proxy.Fetch(objectType, criteria, context);
                    if (expiration > 0)
                    {
                        cacheProvider.Put(key, results, new TimeSpan(0, expiration, 0));
                    }
                    else
                    {
                        cacheProvider.Put(key, results);
                    }

                    return(results);
                }
                else
                {
                    //cache hit
                    return((DataPortalResult)data);
                }
            }
            else
            {
                proxy = GetDataPortalProxy();
                return(proxy.Fetch(objectType, criteria, context));
            }
        }
コード例 #11
0
        public DataPortalResult Fetch(Type objectType, object criteria, DataPortalContext context)
        {
            var cachingAttribute = ObjectCacheAttribute.GetObjectCacheAttribute(objectType);
            var cacheProvider = CacheManager.GetCacheProvider();

            if (cachingAttribute != null && cacheProvider != null)
            {
                //get scenario details
                var scope = cachingAttribute.Scope;
                var cacheByCriteria = cachingAttribute.CacheByCriteria;
                var expiration = cachingAttribute.Expiration;
                
                //get key
                var key = GetCacheItemKey(objectType, cachingAttribute);

                //include criteria hash if needed
                if (cachingAttribute.CacheByCriteria)
                    key = string.Format("{0}::{1}", key, criteria.GetHashCode());

                var data = cacheProvider.Get(key);
                if (data == null)
                {
                    //cache miss
                    proxy = GetDataPortalProxy();
                    var results = proxy.Fetch(objectType, criteria, context);
                    if (expiration > 0)
                        cacheProvider.Put(key, results, new TimeSpan(0, expiration, 0));
                    else
                        cacheProvider.Put(key, results);

                    return results;
                }
                else
                {
                    //cache hit
                    return (DataPortalResult)data;
                }
            }
            else
            {
                proxy = GetDataPortalProxy();
                return proxy.Fetch(objectType, criteria, context);
            }
        }
コード例 #12
0
        public async Task<DataPortalResult> Fetch(Type objectType, object criteria, DataPortalContext context, bool isSync)
        {
            var cachingAttribute = ObjectCacheAttribute.GetObjectCacheAttribute(objectType);
            var cacheProvider = CacheManager.GetCacheProvider();

            if (cachingAttribute != null && cacheProvider != null)
            {
                //get scenario details
                var scope = cachingAttribute.Scope;
                var cacheByCriteria = cachingAttribute.CacheByCriteria;
                var expiration = cachingAttribute.Expiration;
                
                //get key
                var key = GetCacheItemKey(objectType, cachingAttribute);

                //include criteria hash if needed
                if (cachingAttribute.CacheByCriteria)
                    key = string.Format("{0}::{1}", key, criteria.GetHashCode());

                var data = cacheProvider.Get(key);
                if (data == null)
                {
                    //cache miss
                    proxy = GetDataPortalProxy();
                    var results = await proxy.Fetch(objectType, criteria, context, isSync);
                    if (expiration > 0)
                        cacheProvider.Put(key, results.ReturnObject, new TimeSpan(0, expiration, 0));
                    else
                        cacheProvider.Put(key, results.ReturnObject);

                    return results;
                }
                else
                {
                    //cache hit
#if !NET45
                    await TaskEx.Delay(0);
#else
                    await Task.Delay(0);
#endif
                    return new DataPortalResult(data);
                }
            }
            else
            {
                proxy = GetDataPortalProxy();
                return await proxy.Fetch(objectType, criteria, context, isSync);
            }
        }