Пример #1
0
        public bool ObjectEqual(RevokeContext entry)
        {
            if (entry == null)
            {
                return(false);
            }
            var ourObj   = Revokee;
            var theirObj = entry.Revokee;

            return(ObjectEqualInternal(ourObj, theirObj));
        }
Пример #2
0
        public void AddRevokeContext(string key, RevokeContext context)
        {
            if (key == null)
            {
                throw new NullReferenceException("Key can't be null");
            }
            if (context == null)
            {
                throw new NullReferenceException("Context can't be null");
            }
            var collection = _entries.GetOrAdd(key, _ => _contextCollectionFactory.Create());

            collection.Insert(context);
        }
Пример #3
0
        public void Insert(RevokeContext context)
        {
            if (context == null)
            {
                throw new NullReferenceException("RevokeContext can not be null");
            }
            var revokee = context.Revokee;

            if (revokee != null)
            {
                var key   = new EquatableWeakReference <object>(revokee);
                var value = context;

                //Override
                _collection.AddOrUpdate(key, value, (_, __) => value);
            }
        }
Пример #4
0
        protected void NotifyOnRevokeOnce(string key, object @this, IRevokeKey revokeKey)
        {
            var newContext = new RevokeContext(@this, revokeKey, TaskScheduler.Current);

            _revokeIndexer.AddRevokeContext(key, newContext);
        }
Пример #5
0
        protected void NotifyOnRevokeOnce(string key, object @this, Func <string, Task> callback)
        {
            var newContext = new RevokeContext(@this, callback, TaskScheduler.Current);

            _revokeIndexer.AddRevokeContext(key, newContext);
        }