public void Remove(DatabaseProfile profile) { if (BaseIndexOf(profile) >= 0) { BaseRemove(profile.Name); } }
/// <summary> /// Impersonate this SecurityContext /// </summary> /// <param name="state">State supplied by the caller</param> /// <returns><c>null</c></returns> /// <remarks> /// <para> /// No impersonation is done and <c>null</c> is always returned. /// </para> /// </remarks> public override IDisposable Impersonate(object state) { DatabaseProfile profile = state as DatabaseProfile; if (profile == null) { throw new ArgumentException("state", "The state must be a DBProfile object."); } // Here we want to impersonate the user that is trying to connect. // If they want to use windows authentication, we need to impersonate the user and set the connection string attribute. if (_useWindowsAuthentication) { // Tell the profile we are using windows impersonation if (profile.ProviderType == "SQL") { profile.ConnectionStringBuilder.Add("Integrated Security", "SSPI"); } if (_securityContext == null) { return(new DisposableImpersonationContext(profile, new WindowsSecurityContext().Impersonate(state))); } else { return(new DisposableImpersonationContext(profile, _securityContext.Impersonate(state))); } } else { profile.ConnectionStringBuilder.Add("UID", _userName); profile.ConnectionStringBuilder.Add("PWD", _password); return(new DisposableImpersonationContext(profile, null)); } }
/// <summary> /// Creates a copy of the database profile into a new database profile. /// </summary> /// <returns></returns> public DatabaseProfile Copy() { DatabaseProfile copySetting = new DatabaseProfile(); foreach (ConfigurationProperty property in this.Properties) { copySetting[property.Name] = this[property.Name]; } copySetting.ConnectionString = this.ConnectionString; return(copySetting); }
/// <summary> /// Initializes a new instance of the <see cref="SqlQuery"/> class with a database profile <see cref="DatabaseProfile"/>. /// </summary> /// <param name="profile">The database profile that contains the connection to the database.</param> public SqlQuery(DatabaseProfile profile) : base(profile) { }
public void Add(DatabaseProfile profile) { BaseAdd(profile); }
public int IndexOf(DatabaseProfile profile) { return(BaseIndexOf(profile)); }
/// <summary> /// Initializes a new instance of the <see cref="OleDbQuery"/> class with a database profile <see cref="DatabaseProfile"/>. /// </summary> /// <param name="profile">The database profile that contains the connection to the database.</param> public OleDbQuery(DatabaseProfile profile) : base(profile) { }
public QueryBase CreateQuery(DatabaseProfile profile) { return(new OdbcQuery(profile)); }
/// <summary> /// Constructor /// </summary> /// <param name="profile">The database profile to use impersonation for.</param> /// <param name="impersonationContext">the impersonation context being wrapped</param> /// <remarks> /// <para> /// Constructor /// </para> /// </remarks> public DisposableImpersonationContext(DatabaseProfile profile, IDisposable impersonationContext) { _profile = profile; _contextImpersonation = impersonationContext; }
/// <summary> /// Initializes a new instance of the <see cref="OdbcQuery"/> class with a database profile <see cref="DatabaseProfile"/>. /// </summary> /// <param name="profile">The database profile that contains the connection to the database.</param> public OdbcQuery(DatabaseProfile profile) : base(profile) { }
/// <summary> /// Gets the ProviderPlugin associated with the provider type specified /// </summary> /// <param name="profile">The DatabaseProfile to use to find the provider plugin.</param> /// <returns></returns> public static IProviderPlugin GetProviderPlugin(DatabaseProfile profile) { return(Plugin.PluginManager.GetPluginByProviderType(profile.ProviderType)); }