Пример #1
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            DatabaseFacade db = new SQLContext().Database;

            //db.EnsureDeleted();
            db.EnsureCreated();
            RegisterFactory.Create();
            Console.WriteLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            DatabaseFacade db = new SQLContext().Database;

            db.EnsureDeleted();
            db.EnsureCreated();

            Suggest.SuggestFactory.Create();

            Console.WriteLine("AllRight");
        }
Пример #3
0
        static void Main(string[] args)
        {
            string connectionString =
                @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=17bang;Integrated Security=True;";

            DbContextOptionsBuilder <SQLContext> optionsBuilder = new DbContextOptionsBuilder <SQLContext>();

            optionsBuilder
            .UseLoggerFactory(consoleLoggerFactory)
            .UseSqlServer(connectionString);



            DatabaseFacade db = new SQLContext(optionsBuilder.Options).Database;

            db.EnsureDeleted();      //如果存在数据库,就删除
            db.EnsureCreated();      //和Migration可能冲突,不要混合使用
            ////db.Migrate();

            RegissterFctory.Create();
            //Suggest.NewFactory.Create();

            Console.Read();
        }