Exemplo n.º 1
0
        public void CheckForDatabaseTablesNotInEF()
        {
            // Checks for tables defined in the database which are not defined in EF
            string errorMsg = "";

            // Create an exclude list
            ExcludeList excludes = new ExcludeList();

            excludes.Add("sysdiagrams");

            // Query the server for database tables
            var tableList = db.Database
                            .SqlQuery <string>("SELECT name FROM sysobjects WHERE xtype = 'U'")
                            .ToList();

            foreach (var tableName in tableList)
            {
                // Look for a code file for this table

                if (!excludes.IsExcluded(tableName))
                {
                    string fileName = SourceRoot + @"\Evolution.DAL\" + getEFTableFileName(tableName);
                    if (!File.Exists(fileName))
                    {
                        errorMsg += "  " + tableName + "\r\n";
                    }
                }
            }

            Assert.IsTrue(string.IsNullOrEmpty(errorMsg), $"Error: The following tables are defined in the database but haven't been imported to EF:\r\n{errorMsg}");
        }
Exemplo n.º 2
0
 public Options()
 {
     ExcludeList.Add(new ExcludeStruct(String.Empty, 0, 0));
     LocalExcludeList.Add(new ExcludeStruct("per-dir .cvsignore ", 0, 0));
     ServerExcludeList.Add(new ExcludeStruct("server ", 0, 0));
 }