/// <summary> /// Checks the current database connection, and if it is set to the /// election db, changes the connection to use the profile db. /// </summary> /// <externalUnit cref="DataServiceDefinition"/> /// <externalUnit cref="db"/> /// <externalUnit cref="CreateDatabase(DataServices.DataServiceDefinition)"/> /// <revision revisor="dev06" date="10/6/2008" version="1.0.0.0"> /// Member created /// </revision> protected void SetTargetDatabaseAsProfile() { // check db contract if (this.dataServiceDefinition == null) { throw new InvalidOperationException("The data service " + "definition cannot be null."); } // explicitly set the election database if (DataServiceDefinition.IsUsingElectionDatabase == true || (DataServiceDefinition.IsUsingProfileDatabase == true)) { // reset to use the election db, not the profile this.db = null; DataServiceDefinition.UseProfileDatabase(); // creat ethe database connection this.CreateDatabase(DataServiceDefinition); } // make sure we have a valid db if (this.db == null) { throw new InvalidOperationException("The db instance cannot " + "be null."); } }
/// <summary> /// Initializes a new instance of the AuthorizationEventArgs class. /// </summary> /// <param name="current">The object that defines the current /// authorization information (this will be cloned for use by this /// object).</param> public AuthorizationEventArgs(DataServiceDefinition current) { if (current != null) { this.Current = (DataServiceDefinition)current.Clone(); } }
/// <summary> /// Sets the data definition, which has the database connection /// credentials. /// </summary> /// <param name="definition">The data definition.</param> /// <externalUnit/> /// <revision revisor="dev14" date="1/25/2010" version="1.1.5.22"> /// Member Created /// </revision> public void SetDefinition(DataServiceDefinition definition) { // set local reference to the data definition this.DataServiceDefinition = definition; }
/// <summary> /// Creates the database. /// </summary> /// <param name="dataDefinition">The data service definition.</param> /// <externalUnit cref="db"/> /// <revision revisor="dev06" date="10/6/2008" version="1.0.0.0"> /// Member created /// </revision> public void CreateDatabase(DataServiceDefinition dataDefinition) { // create the database this.db = new SqlDatabase(dataDefinition.ConnectionString); }