コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionAddMethodInterceptor"/> class.
        /// </summary>
        /// <param name="instanceDescriptor">The <see cref="Model.InstanceDescriptor"/>.</param>
        /// <param name="collectionPropertyAssociation">The <see cref="Model.Values.CollectionPropertyAssociation"/>.</param>
        /// <param name="collectionItemFactoryProvider">The <see cref="ICollectionItemFactoryProvider"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="collectionPropertyAssociation"/>', '<paramref name="collectionItemFactoryProvider"/>', '<paramref name="instanceDescriptor"/>' and '<paramref name="instanceRelationStore"/>' cannot be null.</exception>
        public CollectionAddMethodInterceptor([NotNull] InstanceDescriptor instanceDescriptor, [NotNull] CollectionPropertyAssociation collectionPropertyAssociation, [NotNull] ICollectionItemFactoryProvider collectionItemFactoryProvider, [NotNull] IInstanceRelationStore instanceRelationStore)
        {
            if (instanceDescriptor == null)
            {
                throw new ArgumentNullException(nameof(instanceDescriptor));
            }

            if (collectionPropertyAssociation == null)
            {
                throw new ArgumentNullException(nameof(collectionPropertyAssociation));
            }

            if (collectionItemFactoryProvider == null)
            {
                throw new ArgumentNullException(nameof(collectionItemFactoryProvider));
            }

            if (instanceRelationStore == null)
            {
                throw new ArgumentNullException(nameof(instanceRelationStore));
            }

            this.instanceDescriptor            = instanceDescriptor;
            this.collectionPropertyAssociation = collectionPropertyAssociation;
            this.collectionItemFactoryProvider = collectionItemFactoryProvider;
            this.instanceRelationStore         = instanceRelationStore;
        }
コード例 #2
0
        public TypeInstanciator([NotNull] IPropertyValueFactoryProvider propertyValueFactoryProvider,
                                [NotNull] ICollectionItemFactoryProvider collectionItemFactoryProvider,
                                [NotNull][ImportMany(typeof(IPropertyValueResolver))] IEnumerable <Lazy <IPropertyValueResolver> > propertyValueResolvers)
        {
            if (propertyValueFactoryProvider == null)
            {
                throw new ArgumentNullException(nameof(propertyValueFactoryProvider));
            }

            if (collectionItemFactoryProvider == null)
            {
                throw new ArgumentNullException(nameof(collectionItemFactoryProvider));
            }

            if (propertyValueResolvers == null)
            {
                throw new ArgumentNullException(nameof(propertyValueResolvers));
            }

            this.propertyValueFactoryProvider  = propertyValueFactoryProvider;
            this.collectionItemFactoryProvider = collectionItemFactoryProvider;
            this.propertyValueResolvers        = propertyValueResolvers;
            this.proxyGenerator         = new ProxyGenerator();
            this.proxyGenerationOptions = new ProxyGenerationOptions
            {
                Selector = new PropertyInterceptorSelector()
            };
        }
コード例 #3
0
        public CollectionPropertyValueFactory([NotNull] ICollectionItemFactoryProvider collectionItemFactoryProvider)
        {
            if (collectionItemFactoryProvider == null)
            {
                throw new ArgumentNullException(nameof(collectionItemFactoryProvider));
            }

            this.collectionItemFactoryProvider = collectionItemFactoryProvider;
        }