예제 #1
0
        /// <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);
        }
예제 #2
0
 /// <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);
 }
예제 #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="EntityManager" /> class.
 /// </summary>
 /// <param name="factoryContext">
 ///     The entity manager factory context.
 /// </param>
 /// <param name="bindingContext">
 ///     The binding context.
 /// </param>
 internal EntityManager(FactoryContext factoryContext, BindingContext bindingContext)
 {
     this.DefaultBehaviors = Behaviors.CreateLazy;
     this.entityContext    = new EntityContext(factoryContext, bindingContext);
 }
예제 #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="EntityManager" /> class.
 /// </summary>
 /// <param name="factoryContext">
 ///     The entity manager factory context.
 /// </param>
 internal EntityManager(FactoryContext factoryContext)
     : this(factoryContext, factoryContext.Configuration.Binding)
 {
 }