public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Table Table = Database.AddTable("TestTable");
     Assert.Equal(Table, Database.Tables[0]);
     Assert.Equal("TestTable", Table.Name);
 }
        /// <summary>
        /// Sets up the databases
        /// </summary>
        public virtual void Setup()
        {
            foreach (IDatabase Key in Mappings.Keys)
            {
                if (Key.Update)
                {
                    string DatabaseName = Regex.Match(Key.ConnectionString, "Initial Catalog=(.*?;)").Value.Replace("Initial Catalog=", "").Replace(";", "");
                    Utilities.SQL.DataClasses.Database TempDatabase = new SQL.DataClasses.Database(DatabaseName);
                    SetupFunctions(TempDatabase);
                    SetupTables(Key, TempDatabase);
                    SetupJoiningTables(Key, TempDatabase);
                    SetupAuditTables(Key, TempDatabase);

                    DatabaseStructures.Add(TempDatabase);
                    foreach (Utilities.SQL.DataClasses.Table Table in TempDatabase.Tables)
                    {
                        Table.SetupForeignKeys();
                    }
                    Utilities.SQL.DataClasses.Database CurrentDatabase = SQL.SQLServer.SQLServer.GetDatabaseStructure(Key.ConnectionString);
                    SQL.SQLServer.SQLServer.UpdateDatabase(TempDatabase, CurrentDatabase, Key.ConnectionString);

                    foreach (IMapping Mapping in Mappings[Key])
                    {
                        foreach (IProperty Property in Mapping.Properties)
                        {
                            Property.SetupLoadCommands();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public void AddColumn()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.View     View     = Database.AddView("TestView");
     View.AddColumn <int>("Column1", DbType.Int32, 0, true);
     Assert.Equal(1, View.Columns.Count);
 }
 public void AddColumn()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.StoredProcedure Function = Database.AddStoredProcedure("TestStoredProcedure", "Definition");
     Function.AddColumn<int>("Column1", DbType.Int32, 0, 0);
     Assert.Equal(1, Function.Columns.Count);
 }
Esempio n. 5
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.View     View     = Database.AddView("TestView");
     Assert.Equal(View, Database.Views[0]);
     Assert.Equal("TestView", View.Name);
 }
Esempio n. 6
0
 public void AddColumn()
 {
     Utilities.SQL.DataClasses.Database        Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.StoredProcedure Function = Database.AddStoredProcedure("TestStoredProcedure", "Definition");
     Function.AddColumn <int>("Column1", DbType.Int32, 0, 0);
     Assert.Equal(1, Function.Columns.Count);
 }
Esempio n. 7
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Table    Table    = Database.AddTable("TestTable");
     Assert.Equal(Table, Database.Tables[0]);
     Assert.Equal("TestTable", Table.Name);
 }
Esempio n. 8
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.View View = Database.AddView("TestView");
     Assert.Equal(View, Database.Views[0]);
     Assert.Equal("TestView", View.Name);
 }
Esempio n. 9
0
 public void AddColumn()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.View View = Database.AddView("TestView");
     View.AddColumn<int>("Column1", DbType.Int32, 0, true);
     Assert.Equal(1, View.Columns.Count);
 }
 public void AddView()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddView("TestTable");
     Assert.Equal(1, Database.Views.Count);
     Assert.Equal("TestTable", Database.Views[0].Name);
     Assert.Equal(Database, Database.Views[0].ParentDatabase);
 }
Esempio n. 11
0
 public void AddTable()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddTable("TestTable");
     Assert.Equal(1, Database.Tables.Count);
     Assert.Equal("TestTable", Database.Tables[0].Name);
     Assert.Equal(Database, Database.Tables[0].ParentDatabase);
 }
Esempio n. 12
0
 public void AddTable()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddTable("TestTable");
     Assert.Equal(1, Database.Tables.Count);
     Assert.Equal("TestTable", Database.Tables.First().Name);
     Assert.Equal(Database, Database.Tables.First().ParentDatabase);
 }
 public void AddView()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddView("TestTable");
     Assert.Equal(1, Database.Views.Count);
     Assert.Equal("TestTable", Database.Views.First().Name);
     Assert.Equal(Database, Database.Views.First().ParentDatabase);
 }
 public void AddStoredProcedures()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddStoredProcedure("TestFunction", "FunctionDefinition");
     Assert.Equal(1, Database.StoredProcedures.Count);
     Assert.Equal("TestFunction", Database.StoredProcedures[0].Name);
     Assert.Equal("FunctionDefinition", Database.StoredProcedures[0].Definition);
     Assert.Equal(Database, Database.StoredProcedures[0].ParentDatabase);
 }
Esempio n. 15
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Function Function = Database.AddFunction("TestFunction", "Definition");
     Assert.Equal(Function, Database.Functions[0]);
     Assert.Equal("TestFunction", Function.Name);
     Assert.Equal("Definition", Function.Definition);
     Assert.Equal(Database, Function.ParentDatabase);
 }
 public void AddStoredProcedures()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddStoredProcedure("TestFunction", "FunctionDefinition");
     Assert.Equal(1, Database.StoredProcedures.Count);
     Assert.Equal("TestFunction", Database.StoredProcedures.First().Name);
     Assert.Equal("FunctionDefinition", Database.StoredProcedures.First().Definition);
     Assert.Equal(Database, Database.StoredProcedures.First().ParentDatabase);
 }
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Assert.Equal("TestDatabase", Database.Name);
     Assert.Equal(0, Database.Functions.Count);
     Assert.Equal(0, Database.StoredProcedures.Count);
     Assert.Equal(0, Database.Tables.Count);
     Assert.Equal(0, Database.Views.Count);
 }
Esempio n. 18
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Function Function = Database.AddFunction("TestFunction", "Definition");
     Assert.Equal(Function, Database.Functions[0]);
     Assert.Equal("TestFunction", Function.Name);
     Assert.Equal("Definition", Function.Definition);
     Assert.Equal(Database, Function.ParentDatabase);
 }
Esempio n. 19
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database        Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.StoredProcedure Function = Database.AddStoredProcedure("TestStoredProcedure", "Definition");
     Assert.Equal(Function, Database.StoredProcedures[0]);
     Assert.Equal("TestStoredProcedure", Function.Name);
     Assert.Equal("Definition", Function.Definition);
     Assert.Equal(Database, Function.ParentDatabase);
 }
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.StoredProcedure Function = Database.AddStoredProcedure("TestStoredProcedure", "Definition");
     Assert.Equal(Function, Database.StoredProcedures[0]);
     Assert.Equal("TestStoredProcedure", Function.Name);
     Assert.Equal("Definition", Function.Definition);
     Assert.Equal(Database, Function.ParentDatabase);
 }
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Assert.Equal("TestDatabase", Database.Name);
     Assert.Equal(0, Database.Functions.Count);
     Assert.Equal(0, Database.StoredProcedures.Count);
     Assert.Equal(0, Database.Tables.Count);
     Assert.Equal(0, Database.Views.Count);
 }
Esempio n. 22
0
 public void AddFunction()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddFunction("TestFunction", "FunctionDefinition");
     Assert.Equal(1, Database.Functions.Count);
     Assert.Equal("TestFunction", Database.Functions[0].Name);
     Assert.Equal("FunctionDefinition", Database.Functions[0].Definition);
     Assert.Equal(Database, Database.Functions[0].ParentDatabase);
 }
Esempio n. 23
0
 public void AddFunction()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Database.AddFunction("TestFunction", "FunctionDefinition");
     Assert.Equal(1, Database.Functions.Count);
     Assert.Equal("TestFunction", Database.Functions.First().Name);
     Assert.Equal("FunctionDefinition", Database.Functions.First().Definition);
     Assert.Equal(Database, Database.Functions.First().ParentDatabase);
 }
 public void AddColumns()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Table Table = Database.AddTable("TestTable");
     IColumn Column = Table.AddColumn<int>("Column1", DbType.Int32);
     Assert.Equal(Column, Table.Columns[0]);
     Assert.Equal("Column1", Column.Name);
     Assert.Equal(DbType.Int32, Column.DataType);
     Assert.Equal("", Column.Default);
 }
Esempio n. 25
0
        public void AddColumns()
        {
            Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
            Utilities.SQL.DataClasses.Table    Table    = Database.AddTable("TestTable");
            IColumn Column = Table.AddColumn <int>("Column1", DbType.Int32);

            Assert.Equal(Column, Table.Columns[0]);
            Assert.Equal("Column1", Column.Name);
            Assert.Equal(DbType.Int32, Column.DataType);
            Assert.Equal("", Column.Default);
        }
Esempio n. 26
0
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database    = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Table    Table       = Database.AddTable("TestTable");
     Utilities.SQL.DataClasses.Trigger  TempTrigger = Table.AddTrigger("Trigger", "Definition", TriggerType.INSERT);
     Assert.Equal(TempTrigger, Table.Triggers[0]);
     Assert.Equal("Trigger", TempTrigger.Name);
     Assert.Equal("Definition", TempTrigger.Definition);
     Assert.Equal(TriggerType.INSERT, TempTrigger.Type);
     Assert.Equal(Table, TempTrigger.ParentTable);
 }
 public void Create()
 {
     Utilities.SQL.DataClasses.Database Database = new Utilities.SQL.DataClasses.Database("TestDatabase");
     Utilities.SQL.DataClasses.Table Table = Database.AddTable("TestTable");
     Utilities.SQL.DataClasses.Trigger TempTrigger = Table.AddTrigger("Trigger", "Definition", TriggerType.INSERT);
     Assert.Equal(TempTrigger, Table.Triggers[0]);
     Assert.Equal("Trigger", TempTrigger.Name);
     Assert.Equal("Definition", TempTrigger.Definition);
     Assert.Equal(TriggerType.INSERT, TempTrigger.Type);
     Assert.Equal(Table, TempTrigger.ParentTable);
 }