コード例 #1
0
        public void InitialiseDb(DbConfiguration dbConfig, DeploymentConfiguration deployConfig)
        {
            Console.WriteLine("Connecting to the Database...");

            SqlConnection connection = new SqlConnection(dbConfig.GetConnectionString());

            try
            {
                EfDataContext efContext = new EfDataContext(connection);
                if (deployConfig.CreateAdmin)
                {
                    if (string.IsNullOrWhiteSpace(deployConfig.AdminPassword))
                    {
                        Console.WriteLine("An Administrator password was not specified.");
                        Console.WriteLine("Skipping admin creation because of this.");
                    }
                    else
                    {
                        //create an admin user
                    }
                }
            }
            catch (SqlException se)
            {
                Exit(1, "A problem occured whilst querying the Database:\n" + se.Message);
            }

            //more stuff here
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: TheFailBoat/PointOfSale
        public void InitialiseDb(DbConfiguration dbConfig, DeploymentConfiguration deployConfig)
        {
            Console.WriteLine("Connecting to the Database...");

            SqlConnection connection = new SqlConnection(dbConfig.GetConnectionString());
            try
            {
                EfDataContext efContext = new EfDataContext(connection);
                if (deployConfig.CreateAdmin)
                {
                    if (string.IsNullOrWhiteSpace(deployConfig.AdminPassword))
                    {
                        Console.WriteLine("An Administrator password was not specified.");
                        Console.WriteLine("Skipping admin creation because of this.");
                    }
                    else
                    {
                        //create an admin user
                    }
                }
            }
            catch(SqlException se)
            {
                Exit(1, "A problem occured whilst querying the Database:\n" + se.Message);
            }

            //more stuff here
        }