Exemplo n.º 1
0
        public void InitializeDatabase(TDbContext context)
        {
            var config = _dbConnectionConfigurationFactory();

            if (config == null)
            {
                return;
            }

            _migrationConfig.TargetDatabase = new DbConnectionInfo(config.ConnectionString, config.DataProvider);

            var migrator = new DbMigrator(_migrationConfig);

            migrator.Update();
            string scriptPath, eoc;

            if (context.Database.Connection.GetType() == typeof(MySqlConnection))
            {
                scriptPath = _appManager.MapPhysicalFile(MySqlScriptPath);
                eoc        = MySqlEOC;
            }
            else
            {
                scriptPath = _appManager.MapPhysicalFile(SqlServerScriptPath);
                eoc        = SqlServerEOC;
            }

            SqlCommandParser parser = new SqlCommandParser(scriptPath, eoc);

            foreach (string command in parser.ParseFromFile(false))
            {
                context.Database.ExecuteSqlCommand(command);
            }
        }
 public ManagerInspactionDriver()
 {
     sqlCommandParser = new SqlCommandParser();
     tRequest         = WebRequest.Create("https://fcm.googleapis.com/fcm/send");
     tRequest.Method  = "post";
     tRequest.Headers.Add(string.Format("Authorization: key={0}", "AAAACa2vxR0:APA91bGTTHJgDmirQgd92-snbn5eixwi-sEPufe8fpl6EojstTcNNMjRnod7nAdUOw0C6InZvWOvom1xlRiWbojN7ObxGTeEPhjBtZ53ac2RLzIVuZc9_AdEkuix-vlul_ylJV7_ctEK"));
     tRequest.Headers.Add(string.Format("Sender: id={0}", "41568683293"));
     tRequest.ContentType = "application/json";
     WorkerInspactionDriver();
 }