Ejemplo n.º 1
0
        WeblogContext GetContext()
        {
            var options = new DbContextOptionsBuilder <WeblogContext>()
                          .UseSqlServer(ConnectionString)
                          .Options;

            var ctx = new WeblogContext(options);

            WeblogDataImporter.EnsureWeblogData(ctx, "server=.;database=Weblog;integrated security=true;");
            return(ctx);
        }
Ejemplo n.º 2
0
        public bool ImportOldWebLog(string oldWeblogConnectionString)
        {
            var connStr = Context.ConnectionString;
            var sql     = new SqlDataAccess(connStr);
            int res     = sql.ExecuteNonQuery("drop table Comments");

            res = sql.ExecuteNonQuery("drop table Posts");
            res = sql.ExecuteNonQuery("drop table Users");
            res = sql.ExecuteNonQuery("drop table Weblogs");

            //if (res < 0)
            //{
            //    SetError(sql.ErrorMessage);
            //    return false;
            //}

            return(WeblogDataImporter.EnsureWeblogData(Context, "server=.;database=weblog;integrated security=true"));
        }