Пример #1
0
        public override IHasId Get(IStoredObjectId soId)
        {
            if (!this.AllowedOperations.Has(StoreOperation.Get))
                throw new InvalidOperationException("operation masked");

            return this.Decorated.Get(soId);
        }
Пример #2
0
        //override all of the store functions, adding audit
        public override IHasId Get(IStoredObjectId soId)
        {
            var val = this.Decorated.Get(soId);

            this.BuildAndSaveAuditPoint(StoredItemAccessMode.Read, val);

            return(val);
        }
Пример #3
0
        public override IHasId Get(IStoredObjectId soId)
        {
            if (!this.AllowedOperations.Has(StoreOperation.Get))
            {
                throw new InvalidOperationException("operation masked");
            }

            return(this.Decorated.Get(soId));
        }
Пример #4
0
        public virtual IHasId Get(IStoredObjectId soId)
        {
//#if DEBUG
//            Debug.WriteLine(string.Format("Id:{0}  Thread:{1}  Type:{2} Store get starts {3}", (this as IHasId).With(o => o.Id).With(o => o.ToString()), Thread.CurrentThread.ManagedThreadId, this.GetType().FullName, soId.With(x => x.ToString())));
//#endif

            var rv = this.Decorated.Get(soId);

//#if DEBUG
//            Debug.WriteLine(string.Format("Id:{0}  Thread:{1}  Type:{2} Store get returns {3}", (this as IHasId).With(o => o.Id).With(o => o.ToString()), Thread.CurrentThread.ManagedThreadId, this.GetType().FullName, rv.With(x => x.GetStoredObjectId().ToString())));
//#endif
            return(rv);
        }
Пример #5
0
        public override IHasId Get(IStoredObjectId soId)
        {
            var retval = this.Decorated.Get(soId);

            StoredObjectId id = StoredObjectId.New(soId.ObjectType, soId.ObjectId);

            if (this.TouchExpirable(id))
            {
                return(retval);
            }

            return(null);
        }
Пример #6
0
        public override IHasId Get(IStoredObjectId soId)
        {
            var uow = this.GetOperationIntercept.Perform(soId);

            if (uow.Error != null)
            {
                var errorStack = string.Join(Environment.NewLine, uow.LogEntries.ToArray());
                this.Logger.LogError("intercept error", errorStack, uow.Error);

                throw new InvalidOperationException("intercept error", uow.Error);
            }

            return(uow.ProcessedResult);
        }
Пример #7
0
        public virtual IHasId Get(IStoredObjectId soId)
        {
            IHasId rv = null;

            //#if DEBUG
            //            Debug.WriteLine(string.Format("Id:{0}  Thread:{1}  Type:{2} Store getting {3}", (this as IHasId).With(o => o.Id).With(o => o.ToString()), Thread.CurrentThread.ManagedThreadId, this.GetType().FullName, soId.With(x => x.ToString())));
            //#endif

            this.Dictionary.TryGetValue(StoredObjectId.New(soId.ObjectType, soId.ObjectId), out rv);


            //#if DEBUG
            //            Debug.WriteLine(string.Format("Id:{0}  Thread:{1}  Type:{2} Store get returns {3}", (this as IHasId).With(o => o.Id).With(o => o.ToString()), Thread.CurrentThread.ManagedThreadId, this.GetType().FullName, rv.With(x => x.GetStoredObjectId().ToString())));
            //#endif

            return(rv);
        }
Пример #8
0
        public virtual IHasId Get(IStoredObjectId soId)
        {
            IHasId rv = null;

            //#if DEBUG
            //            Debug.WriteLine(string.Format("Id:{0}  Thread:{1}  Type:{2} Store getting {3}", (this as IHasId).With(o => o.Id).With(o => o.ToString()), Thread.CurrentThread.ManagedThreadId, this.GetType().FullName, soId.With(x => x.ToString())));
            //#endif

            this.Dictionary.TryGetValue(StoredObjectId.New(soId.ObjectType, soId.ObjectId), out rv);


            //#if DEBUG
            //            Debug.WriteLine(string.Format("Id:{0}  Thread:{1}  Type:{2} Store get returns {3}", (this as IHasId).With(o => o.Id).With(o => o.ToString()), Thread.CurrentThread.ManagedThreadId, this.GetType().FullName, rv.With(x => x.GetStoredObjectId().ToString())));
            //#endif

            return rv;
        }
Пример #9
0
        public override Core.Identifying.IHasId Get(IStoredObjectId soId)
        {
            this.Logger.LogVerbose("Get started", null);

            try
            {
                return(Decorated.Get(soId));
            }
            catch (Exception ex)
            {
                this.Logger.LogError(ex.Message, null, ex);
                throw;
            }
            finally
            {
                this.Logger.LogVerbose("Get completed", null);
            }
        }
Пример #10
0
        public override Core.Identifying.IHasId Get(IStoredObjectId soId)
        {
            this.Logger.LogVerbose("Get started", null);

            try
            {
                return Decorated.Get(soId);
            }
            catch (Exception ex)
            {
                this.Logger.LogError(ex.Message, null, ex);
                throw;
            }
            finally
            {
                this.Logger.LogVerbose("Get completed", null);
            }
        }
Пример #11
0
        /// <summary>
        /// gets the property of type T with the name of the IHasId.Id value
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="iHasId"></param>
        /// <returns></returns>
        public virtual IHasId Get(IStoredObjectId soId)
        {
            if (soId == null)
            {
                return(null);
            }

            //get the store item (our native format)
            StoredObjectId key  = StoredObjectId.New(soId.ObjectType, soId.ObjectId);
            var            item = this.JSONObject.Get <SerializedIHasId>(key.ToString());

            //return the nested object
            if (item == null)
            {
                return(null);
            }

            return(item.GetStoredItem());
        }
Пример #12
0
        /// <summary>
        /// looks for the object but if it isn't there it will be created
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public override IHasId Get(IStoredObjectId soId)
        {
            var retval = this.Decorated.Get(soId);

            //not here
            if (retval == null)
            {
                //build it
                lock (this._stateLock)
                {
                    var factoryLogic = this.Factory.Perform(soId) as LogicOfTo <IStoredObjectId, IHasId>;
                    retval = factoryLogic.Result;
                    //save it
                    if (retval != null)
                    {
                        this.SaveItem(retval);
                    }
                }
            }
            return(retval);
        }
Пример #13
0
        /// <summary>
        /// looks for the object but if it isn't there it will be created
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public override IHasId Get(IStoredObjectId soId)
        {
            var retval = this.Decorated.Get(soId);

            //not here
            if (retval == null)
            {
                //build it
                lock (this._stateLock)
                {
                    var factoryLogic = this.Factory.Perform(soId) as LogicOfTo<IStoredObjectId, IHasId>;
                    retval = factoryLogic.Result;
                    //save it
                    if (retval != null)
                    {
                        this.SaveItem(retval);
                    }
                }
            }
            return retval;
        }
Пример #14
0
        public override IHasId Get(IStoredObjectId soId)
        {
            var retval = this.CachingStore.Get(soId);

            if (retval == null)
            {
                //hit the actual store
                lock (this._stateLock)
                {
                    retval = this.Decorated.Get(soId);

                    //something is here, save it in the cache
                    if (retval != null)
                    {
                        this.CachingStore.SaveItem(retval);
                    }
                }
            }

            return(retval);
        }
Пример #15
0
        public override IHasId Get(IStoredObjectId soId)
        {
            var retval = this.CachingStore.Get(soId);

            if (retval == null)
            {
                //hit the actual store
                lock (this._stateLock)
                {
                    retval = this.Decorated.Get(soId);

                    //something is here, save it in the cache
                    if (retval != null)
                    {
                        this.CachingStore.SaveItem(retval);
                    }
                }
            }

            return retval;
        }
Пример #16
0
        public override IHasId Get(IStoredObjectId soId)
        {
            var retval = this.Decorated.Get(soId);

            StoredObjectId id = StoredObjectId.New(soId.ObjectType, soId.ObjectId);
            if (this.TouchExpirable(id))
                return retval;

            return null;
        }
Пример #17
0
 public IHasId Get(IStoredObjectId soId)
 {
     return(this.Store.Get(soId));
 }
        public override IHasId Get(IStoredObjectId soId)
        {
            var uow = this.GetOperationIntercept.Perform(soId);
            if (uow.Error != null)
            {
                var errorStack = string.Join(Environment.NewLine, uow.LogEntries.ToArray());
                this.Logger.LogError("intercept error", errorStack, uow.Error);

                throw new InvalidOperationException("intercept error", uow.Error);
            }

            return uow.ProcessedResult;
        }