Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicQueryProvider"/> class.
        /// </summary>
        /// <param name="instances">The associated <see cref="IDynamicDbContext"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <param name="queryResultHandlerProvider">The <see cref="IQueryResultHandlerProvider"/>.</param>
        /// <param name="queryableCallTreeTranslator">The <see cref="QueryableCallTreeTranslator"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="instanceRelationStore"/>', '<paramref name="queryResultHandlerProvider"/>', '<paramref name="instances"/>', '<paramref name="queryableCallTreeTranslator"/>' cannot be null.</exception>
        public DynamicQueryProvider([NotNull] IQueryable <InstanceDescriptor> instances, [NotNull] IInstanceRelationStore instanceRelationStore, [NotNull] IQueryResultHandlerProvider queryResultHandlerProvider, [NotNull] IQueryableCallTreeTranslator queryableCallTreeTranslator)
        {
            if (instances == null)
            {
                throw new ArgumentNullException(nameof(instances));
            }

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

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

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

            this.instances                   = instances;
            this.instanceRelationStore       = instanceRelationStore;
            this.queryResultHandlerProvider  = queryResultHandlerProvider;
            this.queryableCallTreeTranslator = queryableCallTreeTranslator;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceProxyingInstanciationContext"/> class.
        /// </summary>
        /// <param name="instanceDescriptor">The <see cref="InstanceDescriptor"/>.</param>
        /// <param name="collectionPropertyAssociation">The <see cref="CollectionPropertyAssociation"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <param name="requestedType">The <see cref="Type"/> which is requested.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="requestedType"/>', '<paramref name="collectionPropertyAssociation"/>', '<paramref name="instanceDescriptor"/>' and '<paramref name="instanceRelationStore"/>' cannot be null.</exception>
        public CollectionProxyingInstanciationContext([NotNull] Type requestedType,
                                                      [NotNull] IInstanceRelationStore instanceRelationStore, [NotNull] InstanceDescriptor instanceDescriptor,
                                                      [NotNull] CollectionPropertyAssociation collectionPropertyAssociation)
        {
            if (instanceDescriptor == null)
            {
                throw new ArgumentNullException(nameof(instanceDescriptor));
            }

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

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

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

            this.InstanceDescriptor            = instanceDescriptor;
            this.CollectionPropertyAssociation = collectionPropertyAssociation;
            this.RequestedType         = requestedType;
            this.InstanceRelationStore = instanceRelationStore;
        }
        /// <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;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PrimitivePropertyChangeTrackingInterceptor"/> class.
        /// </summary>
        /// <param name="instanceDescriptor">The associated <see cref="InstanceDescriptor"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <param name="propertyValueFactoryProvider">The <see cref="IPropertyValueFactoryProvider"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="instanceRelationStore"/>', '<paramref name="propertyValueFactoryProvider"/>' and '<paramref name="instanceDescriptor"/>' cannot be null.</exception>
        public ComplexPropertyChangeTrackingInterceptor([NotNull] InstanceDescriptor instanceDescriptor, [NotNull] IPropertyValueFactoryProvider propertyValueFactoryProvider,
                                                        [NotNull] IInstanceRelationStore instanceRelationStore) : base(instanceDescriptor, propertyValueFactoryProvider)
        {
            if (instanceRelationStore == null)
            {
                throw new ArgumentNullException(nameof(instanceRelationStore));
            }

            this.instanceRelationStore = instanceRelationStore;
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicDbContextAdapter"/> class.
        /// </summary>
        /// <param name="dynamicDbContextFactory">The <see cref="ExportFactory{IDynamicDbContext}"/>.</param>
        /// <param name="instanceDescriptorFactory">The <see cref="IInstanceDescriptorFactory"/>.</param>
        /// <param name="instanceResolutionWalkerFactory">The <see cref="IInstanceResolutionWalker"/> factory.</param>
        /// <param name="queryResultHandlerProvider">The <see cref="IQueryResultHandlerProvider"/></param>
        /// <param name="queryableCallTreeTranslator">The <see cref="QueryableCallTreeTranslator"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <param name="dynamicDbContextConfiguration">The configuration for the <see cref="IDynamicDbContext"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="queryableCallTreeTranslator"/>', '<paramref name="instanceRelationStore"/>', '<paramref name="queryResultHandlerProvider"/>', '<paramref name="instanceDescriptorFactory"/>', '<paramref name="queryableCallTreeTranslator"/>' ,'<paramref name="dynamicDbContextFactory"/>' and '<paramref name="instanceResolutionWalkerFactory"/>' cannot be null.</exception>
        protected DynamicDbContextAdapter([NotNull] IDynamicDbContextFactory dynamicDbContextFactory,
                                          [NotNull] IInstanceDescriptorFactory instanceDescriptorFactory,
                                          [NotNull] ExportFactory <IInstanceResolutionWalker> instanceResolutionWalkerFactory,
                                          [NotNull] IQueryResultHandlerProvider queryResultHandlerProvider,
                                          [NotNull] IQueryableCallTreeTranslator queryableCallTreeTranslator,
                                          [NotNull] IInstanceRelationStore instanceRelationStore,
                                          [NotNull] DynamicDbContextConfiguration dynamicDbContextConfiguration)
        {
            if (dynamicDbContextFactory == null)
            {
                throw new ArgumentNullException(nameof(dynamicDbContextFactory));
            }

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

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

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

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

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

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

            this.instanceDescriptorFactory       = instanceDescriptorFactory;
            this.instanceResolutionWalkerFactory = instanceResolutionWalkerFactory;
            this.queryResultHandlerProvider      = queryResultHandlerProvider;
            this.queryableCallTreeTranslator     = queryableCallTreeTranslator;
            this.instanceRelationStore           = instanceRelationStore;
            this.dynamicDbContext            = dynamicDbContextFactory.CreateDynamicDbContext(dynamicDbContextConfiguration);
            this.createdDynamicDbSetAdapters = new ConcurrentDictionary <Type, Object>();

            this.CreateDynamidDbSetAdapters();
        }
Пример #6
0
        public ResultHandlerContext([CanBeNull] Object result, [NotNull] IInstanceRelationStore instanceRelationStore, Boolean noChangeTracking, Boolean noLazyLoading)
        {
            if (instanceRelationStore == null)
            {
                throw new ArgumentNullException(nameof(instanceRelationStore));
            }

            this.Result = result;
            this.InstanceRelationStore = instanceRelationStore;
            this.NoChangeTracking      = noChangeTracking;
            this.NoLazyLoading         = noLazyLoading;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceDescriptorCreationContext"/> class.
        /// </summary>
        /// <param name="currentInstance">The current object.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="instanceRelationStore"/>' and '<paramref name="currentInstance"/>' cannot be null.</exception>
        public InstanceDescriptorCreationContext([NotNull] Object currentInstance, [NotNull] IInstanceRelationStore instanceRelationStore)
        {
            if (currentInstance == null)
            {
                throw new ArgumentNullException(nameof(currentInstance));
            }

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

            this.CurrentInstance       = currentInstance;
            this.InstanceRelationStore = instanceRelationStore;
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultTypeInstanciationContext"/> class.
        /// </summary>
        /// <param name="requestedType">The <see cref="Type"/> that is requested.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="requestedType"/>' and '<paramref name="instanceRelationStore"/>' cannot be null.</exception>
        public DefaultTypeInstanciationContext([NotNull] Type requestedType,
                                               [NotNull] IInstanceRelationStore instanceRelationStore)
        {
            if (requestedType == null)
            {
                throw new ArgumentNullException(nameof(requestedType));
            }

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

            this.RequestedType         = requestedType;
            this.InstanceRelationStore = instanceRelationStore;
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicDbSetAdapter{T}"/> class.
        /// </summary>
        /// <param name="instances">The underlying <see cref="DbSet{InstanceDescriptor}"/>.</param>
        /// <param name="instanceDescriptorFactory">The <see cref="IInstanceDescriptorFactory"/>.</param>
        /// <param name="instanceResolutionWalkerFactory">The <see cref="ExportFactory{IInstanceResolutionWalker}"/> which create new instances of <see cref="IInstanceResolutionWalker"/>.</param>
        /// <param name="queryResultHandlerProvider">The <see cref="IQueryResultHandlerProvider"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <param name="queryableCallTreeTranslator">The <see cref="IQueryableCallTreeTranslator"/>.</param>
        public DynamicDbSetAdapter([NotNull] DbSet <InstanceDescriptor> instances, [NotNull] IInstanceDescriptorFactory instanceDescriptorFactory, [NotNull] ExportFactory <IInstanceResolutionWalker> instanceResolutionWalkerFactory, [NotNull] IQueryResultHandlerProvider queryResultHandlerProvider, [NotNull] IInstanceRelationStore instanceRelationStore, [NotNull] IQueryableCallTreeTranslator queryableCallTreeTranslator)
        {
            if (instances == null)
            {
                throw new ArgumentNullException(nameof(instances));
            }

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

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

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

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

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

            this.instances = instances;
            this.instanceDescriptorFactory       = instanceDescriptorFactory;
            this.instanceResolutionWalkerFactory = instanceResolutionWalkerFactory;
            this.queryResultHandlerProvider      = queryResultHandlerProvider;
            this.queryableCallTreeTranslator     = queryableCallTreeTranslator;
            this.instanceRelationStore           = instanceRelationStore;

            this.instanceRelationStore.InstanceRelationChanged += this.InstanceRelationStoreOnInstanceRelationChanged;

            this.local = new ObservableCollection <T>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceProxyingInstanciationContext"/> class.
        /// </summary>
        /// <param name="instanceDescriptor">The <see cref="InstanceDescriptor"/>.</param>
        /// <param name="requestedType">The <see cref="Type"/> which is requested.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="requestedType"/>', '<paramref name="instanceDescriptor"/>' and '<paramref name="instanceRelationStore"/>' cannot be null.</exception>
        public InstanceProxyingInstanciationContext([NotNull] InstanceDescriptor instanceDescriptor, [NotNull] Type requestedType,
                                                    [NotNull] IInstanceRelationStore instanceRelationStore)
        {
            if (instanceDescriptor == null)
            {
                throw new ArgumentNullException(nameof(instanceDescriptor));
            }

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

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

            this.InstanceDescriptor    = instanceDescriptor;
            this.RequestedType         = requestedType;
            this.InstanceRelationStore = instanceRelationStore;
        }
Пример #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LazyLoadingComplexPropertyInterceptor"/> class.
        /// </summary>
        /// <param name="instanceDescriptor">The associated <see cref="InstanceDescriptor"/>.</param>
        /// <param name="instancRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <param name="propertyValueResolvers">The <see cref="IInstanceRelationStore"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="instanceDescriptor"/>', '<paramref name="instancRelationStore"/>' and '<paramref name="propertyValueResolvers"/>' cannot be null.</exception>
        public LazyLoadingComplexPropertyInterceptor([NotNull] InstanceDescriptor instanceDescriptor,
                                                     [NotNull] IInstanceRelationStore instancRelationStore,
                                                     [NotNull] IEnumerable <IPropertyValueResolver> propertyValueResolvers)
        {
            if (instanceDescriptor == null)
            {
                throw new ArgumentNullException(nameof(instanceDescriptor));
            }

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

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

            this.instanceDescriptor     = instanceDescriptor;
            this.instancRelationStore   = instancRelationStore;
            this.propertyValueResolvers = propertyValueResolvers;
        }
Пример #12
0
 public ResultHandlerContext([CanBeNull] Object result, [NotNull] IInstanceRelationStore instanceRelationStore)
     : this(result, instanceRelationStore, false, false)
 {
 }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceResolutionContext"/> class.
        /// </summary>
        /// <param name="instanceDescriptor">The <see cref="InstanceDescriptor"/>.</param>
        /// <param name="instanceRelationStore">The <see cref="IInstanceRelationStore"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="instanceDescriptor"/>' and '<paramref name="instanceRelationStore"/>' cannot be null.</exception>
        public InstanceResolutionContext([NotNull] InstanceDescriptor instanceDescriptor, [NotNull] IInstanceRelationStore instanceRelationStore)
        {
            if (instanceDescriptor == null)
            {
                throw new ArgumentNullException(nameof(instanceDescriptor));
            }

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

            this.InstanceDescriptor = instanceDescriptor;
            this.InstanceRelationStore = instanceRelationStore;
        }