Example #1
0
        public ServiceStore()
        {
            var type = typeof(T);

            if (!type.IsInterface)
            {
                throw new ArgumentException("Service Store only supports interface types", nameof(T));
            }

            _state  = new InterfaceState(type);
            _events = new Dictionary <PropertyInfo, IAsyncEventWithData>();
        }
Example #2
0
        public AccessInterceptor(InterfaceState state, bool allowModifications = false)
        {
            _state = state;
            _allowModifications = allowModifications;

            _oldValues           = state.Properties.ToDictionary(p => p, p => state[p]);
            _oldCollectionValues = state.CollectionProperties
                                   .ToDictionary(p => p, p => (state[p] as IEnumerable).Cast <object>().ToArray());
            _collectionChanges = new EditableLookup <PropertyInfo, IChange>();
            _literalChanges    = new Dictionary <PropertyInfo, object>();
            _proxies           = new Dictionary <PropertyInfo, IStateList>();
        }