/// <summary> /// Initializes a new instance of the <see cref="PersistenceConfiguration" /> class. /// </summary> /// <param name="configuration"> /// The configuration. /// </param> /// <exception cref="ArgumentNullException"> /// If <paramref name="configuration" /> is null. /// </exception> public PersistenceConfiguration(PersistenceConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } this.rootNamespace = configuration.RootNamespace; this.Binding = new BindingContext(configuration.Binding); this.mutatorSpec = new MutatorSpec(configuration.MutatorSpec); this.UseAsyncTableScanner = configuration.UseAsyncTableScanner; this.ReviewScanSpec = configuration.ReviewScanSpec; }
/// <summary> /// Initializes a new instance of the <see cref="EntityManagerFactory" /> class. /// </summary> /// <param name="configuration"> /// The persistence configuration. /// </param> /// <param name="context"> /// The context. /// </param> /// <param name="disposeContext"> /// Indicating whether this entity manager factory owns the database context. /// </param> /// <exception cref="ArgumentNullException"> /// If <paramref name="configuration" /> is null. /// </exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="context" /> is null. /// </exception> private EntityManagerFactory(PersistenceConfiguration configuration, IContext context, bool disposeContext = true) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } this.factoryContext = new FactoryContext(configuration, context, disposeContext); }
/// <summary> /// Initializes a new instance of the <see cref="FactoryContext" /> class. /// </summary> /// <param name="configuration"> /// The persistence configuration. /// </param> /// <param name="context"> /// The database context. /// </param> /// <param name="disposeContext"> /// Flag indicating whether this factory context owns the database context. /// </param> /// <exception cref="ArgumentNullException"> /// If <paramref name="configuration" /> is null. /// </exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="context" /> is null. /// </exception> internal FactoryContext(PersistenceConfiguration configuration, IContext context, bool disposeContext) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } this.configuration = configuration; this.context = context; this.disposeContext = disposeContext; this.client = context.CreateClient(); }
/// <summary> /// Initializes a new instance of the <see cref="PersistenceConfiguration" /> class. /// </summary> /// <param name="configuration"> /// The configuration. /// </param> /// <param name="bindingContext"> /// The binding context. /// </param> /// <exception cref="ArgumentNullException"> /// If <paramref name="configuration" /> is null. /// </exception> /// <exception cref="ArgumentNullException"> /// If <paramref name="bindingContext" /> is null. /// </exception> internal PersistenceConfiguration(PersistenceConfiguration configuration, BindingContext bindingContext) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (bindingContext == null) { throw new ArgumentNullException(nameof(bindingContext)); } this.rootNamespace = configuration.RootNamespace; this.Binding = bindingContext; this.mutatorSpec = new MutatorSpec(configuration.MutatorSpec); this.UseAsyncTableScanner = configuration.UseAsyncTableScanner; this.UseParallelDeserialization = configuration.UseParallelDeserialization; this.ReviewScanSpec = configuration.ReviewScanSpec; this.ReviewKey = configuration.ReviewKey; this.Context = configuration.Context; }
/// <summary> /// Initializes a new instance of the <see cref="EntityContext" /> class. /// </summary> /// <param name="factoryContext"> /// The factory context. /// </param> /// <param name="bindingContext"> /// The binding context. /// </param> internal EntityContext(FactoryContext factoryContext, BindingContext bindingContext) : base(bindingContext) { this.factoryContext = factoryContext; this.configuration = new PersistenceConfiguration(factoryContext.Configuration, this); }
/// <summary> /// Create a new entity manager factory using the database context and the persistence configuration specified. /// </summary> /// <param name="ctx"> /// The existing database context. /// </param> /// <param name="configuration"> /// The persistence configuration. /// </param> /// <returns> /// The newly created entity manager factory. /// </returns> /// <remarks> /// The entity manager does not take ownership of the database context specified. /// </remarks> public static EntityManagerFactory CreateEntityManagerFactory(IContext ctx, PersistenceConfiguration configuration) { return(CreateEntityManagerFactory(ctx, false, configuration)); }
/// <summary> /// Create a new entity manager factory using the connection string, the configuration properties and the persistence /// configuration specified. /// </summary> /// <param name="connectionString"> /// The connection string. /// </param> /// <param name="properties"> /// The configuration properties. /// </param> /// <param name="configuration"> /// The persistence configuration. /// </param> /// <returns> /// The newly created entity manager factory. /// </returns> public static EntityManagerFactory CreateEntityManagerFactory(string connectionString, IDictionary <string, object> properties, PersistenceConfiguration configuration) { return(CreateEntityManagerFactory(Context.Create(connectionString, properties), true, configuration)); }
/// <summary> /// Create a new entity manager factory using the connection string specified and the persistence configuration /// specified. /// </summary> /// <param name="connectionString"> /// The connection string. /// </param> /// <param name="configuration"> /// The persistence configuration. /// </param> /// <returns> /// The newly created entity manager factory. /// </returns> public static EntityManagerFactory CreateEntityManagerFactory(string connectionString, PersistenceConfiguration configuration) { return(CreateEntityManagerFactory(Context.Create(connectionString), true, configuration)); }