Overriding MembershipProvider and RoleProvider Initialize method
Posted: Wed 07 Jan 2015 02:49
I am overriding the Initialize method of PgSqlMembershipProvider and PgSqlRoleProvider because our web application connects to different databases with the same schema. For this, I have 2 classes that inherit from PgSqlMembershipProvider and from PgSqlRoleProvider. How does the Initialize method work? When is it executed? How can I execute it on-demand so I can re-define the connection string in order to modify the database?
In the code below, the method "Utilerias.ObtenerConnString" returns a new connection string which includes a database depending on a certain criteria.
Respectfully,
Jorge Maldonado
In the code below, the method "Utilerias.ObtenerConnString" returns a new connection string which includes a database depending on a certain criteria.
Code: Select all
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
String strConn = Utilerias.ObtenerConnString();
base.Initialize(name, config);
base.connectionString = strConn;
}
Jorge Maldonado