ConnectorDataItemClassSetDB Method |
Namespace: SOWIData.Database
/// <summary> /// Set database /// </summary> protected override void SetDB() { try { this.DB = new SOWIData.Management.Database.Tables(this.ConnectionString); if (!this.DB.Database.Exists()) { throw new Exception("database not exists!"); } } catch (Exception ex) { SIC.Protocol.Write(ref ex); throw ex; } }
/// <summary> /// Puts XML data connector via property ConnectionString /// </summary> /// <remarks> /// For a XML data connector must the property value DataSource of ConnectionString equal XML (see <see cref="SOWIData.Providers"/>. <para/> /// Then is property value InitialCatalog the XML file name. /// </remarks> /// <seealso cref="SOWIData.Providers"/> /// <seealso cref="SqlConnectionStringBuilder"/> protected override void SetDB() { try { //* analysis of property ConnectionString * SqlConnectionStringBuilder lConnectionString = new SqlConnectionStringBuilder(this.ConnectionString); string lDataSource = lConnectionString.DataSource; if (lDataSource.ToUpper() == SOWIData.Providers.XML.ToString()) { //* puts XML data connector * string lFileName = lConnectionString.InitialCatalog; this.XML = new SOWIData.XML.Document<SOWIData.Test.TestObject.SOWIDataStandard>(lFileName); } } catch (Exception ex) { SIC.Protocol.Write(ref ex); throw ex; } }