public static Database LoadNewDatabase( string name, DatabaseTypes databaseType, BLL.ConnectionStringHelper connectionString) { return(LoadNewDatabase(name, databaseType, connectionString, null, null, null, true, true, true)); }
/// <summary> /// TODO: I don't think this should be exposed to the user??? /// </summary> /// <param name="name"></param> /// <param name="connectionString"></param> /// <param name="databaseType"></param> /// <param name="tables"></param> /// <param name="views"></param> /// <param name="storedProcedures"></param> public Database(string name, BLL.ConnectionStringHelper connectionString, DatabaseTypes databaseType, Table[] tables, View[] views, StoredProcedure[] storedProcedures) { _name = name; _connectionString = connectionString; _databaseType = databaseType; if (tables != null) { _tables.AddRange(tables); foreach (Table table in tables) { table.Database = this; } } if (views != null) { _views.AddRange(views); foreach (View view in views) { view.Database = this; } } if (storedProcedures != null) { _storedProcedures.AddRange(storedProcedures); foreach (StoredProcedure storedProcedure in storedProcedures) { storedProcedure.Database = this; } } }
public SQLServerBase(BLL.ConnectionStringHelper connectionString) { _connectionString = connectionString; _serverName = connectionString.ServerName; _databaseName = connectionString.DatabaseName; _userName = connectionString.UserName; _password = connectionString.Password; }
public SQLServerBase(BLL.ConnectionStringHelper connectionString) { _connectionString = connectionString; _serverName = connectionString.ServerName; _databaseName = connectionString.DatabaseName; _userName = connectionString.UserName; _password = connectionString.Password; }
public static Database LoadNewDatabase( string name, DatabaseTypes databaseType, BLL.ConnectionStringHelper connectionString, bool fetchTables, bool fetchViews, bool fetchStroredProcedures) { return(LoadNewDatabase(name, databaseType, connectionString, null, null, null, fetchTables, fetchViews, fetchStroredProcedures)); }
public SQLServerBase(BLL.ConnectionStringHelper connectionString) { _sqlServerString = connectionString; _serverName = connectionString.ServerName; _databaseName = connectionString.DatabaseName; _login = connectionString.UserName; _password = connectionString.Password; _sqlServer.Connect(_serverName, _login, _password); if (_databaseName != "") { _database = (SQLDMO.Database)_sqlServer.Databases.Item(_databaseName, _sqlServer); } }
public SQLServerBase(BLL.ConnectionStringHelper connectionString) { _sqlServerString = connectionString; _serverName = connectionString.ServerName; _databaseName = connectionString.DatabaseName; _login = connectionString.UserName; _password = connectionString.Password; _sqlServer.Connect(_serverName, _login, _password); if (_databaseName != "") { _database = (SQLDMO.Database)_sqlServer.Databases.Item(_databaseName, _sqlServer); } }
public static IDAL.ITable CreateTable(DatabaseTypes dalAssemblyName, BLL.ConnectionStringHelper connectionString) { switch (dalAssemblyName) { case DatabaseTypes.SQLServer2000: return(new SQLServerDAL_2005.Table(connectionString)); case DatabaseTypes.SQLServer2005: return(new SQLServerDAL_2005.Table(connectionString)); case DatabaseTypes.SQLServerExpress: return(new SQLServerDAL_Express.Table(connectionString)); default: throw new NotImplementedException("Not handled yet: " + dalAssemblyName); } }
/// <summary> /// Gets the database schema and creats an object model. /// </summary> /// <param name="name"></param> /// <param name="databaseType"></param> /// <param name="connectionString"></param> /// <param name="tablePrefixes"></param> /// <param name="viewPrefixes"></param> /// <param name="storedProcedurePredixes"></param> /// <param name="fetchTables"></param> /// <param name="fetchViews"></param> /// <param name="fetchStroredProcedures"></param> /// <returns></returns> public static Database LoadNewDatabase( string name, DatabaseTypes databaseType, BLL.ConnectionStringHelper connectionString, List <string> tablePrefixes, List <string> viewPrefixes, List <string> storedProcedurePredixes, bool fetchTables, bool fetchViews, bool fetchStroredProcedures) { Utility.ResetAllConnections(); Table.TablePrefixes = tablePrefixes ?? new List <string>(); View.ViewPrefixes = viewPrefixes ?? new List <string>(); StoredProcedure.StoredProcedurePrefixes = storedProcedurePredixes ?? new List <string>(); BLL.Table bllTable; BLL.View bllView; BLL.StoredProcedure bllStoredProcedure; Table[] tables = null; View[] views = null; StoredProcedure[] storedProcedures = null; if (fetchTables) { bllTable = new BLL.Table(databaseType, connectionString); tables = bllTable.Tables; } if (fetchViews) { bllView = new BLL.View(databaseType, connectionString); views = bllView.Views; } if (fetchStroredProcedures) { bllStoredProcedure = new BLL.StoredProcedure(databaseType, connectionString); storedProcedures = bllStoredProcedure.StoredProcedures; } return(new Database(name, connectionString, databaseType, tables, views, storedProcedures)); }
public Database(BLL.ConnectionStringHelper connectionString) : base(connectionString) { }
// TODO; Implement //private readonly string UnsupportedDataTypes = "'binary', 'sql_variant', 'timestamp', 'varbinary'"; public StoredProcedure(BLL.ConnectionStringHelper connectionString) : base(connectionString) { }
public View(BLL.ConnectionStringHelper connectionString) : base(connectionString) { }
public Table(BLL.ConnectionStringHelper connectionString) : base(connectionString) { }
/// <exclude/> /// <summary> /// Deserialization Constructor. TODO: I don't think this should be exposed to the user??? /// </summary> public Database(SerializationInfo serializationInfo, StreamingContext streamingContext) //: base(null) { if (SerializerHelper.UseFastSerialization) { using ( SerializationReader reader = new SerializationReader((byte[])serializationInfo.GetValue("d", typeof(byte[])))) { _connectionString = (BLL.ConnectionStringHelper)reader.ReadObject(); _databaseType = (DatabaseTypes)reader.ReadObject(); _name = reader.ReadString(); _storedProcedures = (List <StoredProcedure>)reader.ReadObject(); _tables = (List <Table>)reader.ReadObject(); _views = (List <View>)reader.ReadObject(); foreach (StoredProcedure sp in _storedProcedures) { sp.Database = this; } foreach (Table table in _tables) { table.Database = this; } foreach (View view in _views) { view.Database = this; } } } else { int version = 0; if (SerializationVersionExists) { try { version = serializationInfo.GetInt32("SerializationVersion"); } catch (SerializationException) { // ignore SerializationVersionExists = false; } } _connectionString = (BLL.ConnectionStringHelper)serializationInfo.GetValue("ConnectionString", ModelTypes.ConnectionStringHelper); if (SerializerHelper.CachedDatabases != null) { foreach (Database db in SerializerHelper.CachedDatabases) { if (_connectionString.IsTheSame(db.ConnectionString)) { return; } } } _databaseType = (DatabaseTypes)serializationInfo.GetValue("DatabaseType", ModelTypes.DatabaseTypes); _name = serializationInfo.GetString("Name"); _storedProcedures = (List <StoredProcedure>)serializationInfo.GetValue("StoredProcedures", ModelTypes.StoredProcedureList); _tables = (List <Table>)serializationInfo.GetValue("Tables", ModelTypes.TableList); _views = (List <View>)serializationInfo.GetValue("Views", ModelTypes.ViewList); if (SerializerHelper.CachedDatabases != null) { SerializerHelper.CachedDatabases.Add(this); } if (version >= 9) { _lookups = (List <Lookup>)serializationInfo.GetValue("Lookups", ModelTypes.LookupList); //foreach (Lookup lookup in _lookups) //{ // lookup.Database = this; //} } } }
/// <summary> /// TODO: I don't think this should be exposed to the user??? /// </summary> /// <param name="name"></param> /// <param name="connectionString"></param> /// <param name="databaseType"></param> public Database(string name, BLL.ConnectionStringHelper connectionString, DatabaseTypes databaseType) { _name = name; _connectionString = connectionString; _databaseType = databaseType; }