コード例 #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);
        }