/// <summary> /// Constructs an <see cref="EagerInternalContext" /> for an already existing <see cref="ObjectContext" />. /// </summary> /// <param name="owner"> /// The owner <see cref="DbContext" /> . /// </param> /// <param name="objectContext"> /// The existing <see cref="ObjectContext" /> . /// </param> public EagerInternalContext(DbContext owner, ObjectContext objectContext, bool objectContextOwned) : base(owner) { DebugCheck.NotNull(objectContext); _objectContext = objectContext; _objectContextOwned = objectContextOwned; _originalConnectionString = InternalConnection.AddAppNameCookieToConnectionString(_objectContext.Connection); InitializeEntitySetMappings(); }
public EagerInternalContext( DbContext owner, ObjectContext objectContext, bool objectContextOwned) : base(owner, (Lazy <DbDispatchers>)null) { this._objectContext = objectContext; this._objectContextOwned = objectContextOwned; this._originalConnectionString = InternalConnection.GetStoreConnectionString(this._objectContext.Connection); this._objectContext.InterceptionContext = this._objectContext.InterceptionContext.WithDbContext(owner); this.ResetDbSets(); this._objectContext.InitializeMappingViewCacheFactory(this.Owner); }
/// <summary> /// Constructs an <see cref="EagerInternalContext" /> for an already existing <see cref="ObjectContext" />. /// </summary> /// <param name="owner"> /// The owner <see cref="DbContext" /> . /// </param> /// <param name="objectContext"> /// The existing <see cref="ObjectContext" /> . /// </param> public EagerInternalContext( DbContext owner, ObjectContext objectContext, bool objectContextOwned) : base(owner) { DebugCheck.NotNull(objectContext); _objectContext = objectContext; _objectContextOwned = objectContextOwned; _originalConnectionString = InternalConnection.GetStoreConnectionString(_objectContext.Connection); _objectContext.InterceptionContext = _objectContext.InterceptionContext.WithDbContext(owner); InitializeEntitySetMappings(); }
// <summary> // Constructs an <see cref="EagerInternalContext" /> for an already existing <see cref="ObjectContext" />. // </summary> // <param name="owner"> // The owner <see cref="DbContext" /> . // </param> // <param name="objectContext"> // The existing <see cref="ObjectContext" /> . // </param> public EagerInternalContext( DbContext owner, ObjectContext objectContext, bool objectContextOwned) : base(owner) { DebugCheck.NotNull(objectContext); _objectContext = objectContext; _objectContextOwned = objectContextOwned; _originalConnectionString = InternalConnection.GetStoreConnectionString(_objectContext.Connection); _objectContext.InterceptionContext = _objectContext.InterceptionContext.WithDbContext(owner); ResetDbSets(); _objectContext.InitializeMappingViewCacheFactory(Owner); }
protected void OnConnectionInitialized() { this._originalConnectionString = InternalConnection.GetStoreConnectionString(this.UnderlyingConnection); try { this._originalDatabaseName = this.UnderlyingConnection is EntityConnection ? this.UnderlyingConnection.Database : DbInterception.Dispatch.Connection.GetDatabase(this.UnderlyingConnection, this.InterceptionContext); } catch (NotImplementedException ex) { } try { this._originalDataSource = this.UnderlyingConnection is EntityConnection ? this.UnderlyingConnection.DataSource : DbInterception.Dispatch.Connection.GetDataSource(this.UnderlyingConnection, this.InterceptionContext); } catch (NotImplementedException ex) { } }