Ejemplo n.º 1
0
        private void CreateTables(ObjectContext objectContext)
        {
            string dataBaseCreateScript =
                objectContext.CreateDatabaseScript();

            objectContext.ExecuteStoreCommand(dataBaseCreateScript);
        }
        private static void GetSchema()
        {
            ObjectContext objectContext = ((IObjectContextAdapter)SessionState.db).ObjectContext;
            var           dbSchema      = objectContext.CreateDatabaseScript();

            NorthwindTwin dbTwin         = new NorthwindTwin();
            ObjectContext objectContext2 = ((IObjectContextAdapter)dbTwin).ObjectContext;

            objectContext2.ExecuteStoreCommand(dbSchema);
        }
Ejemplo n.º 3
0
        private static void createTables(TenantContext t)
        {
            ObjectContext x = getCtx(t);
            string        d = x.CreateDatabaseScript();

            try
            {
                t.Database.ExecuteSqlCommand(d);
            }
            catch (Exception e) {
                t.Database.Connection.Close();
                throw e;
            }
        }
Ejemplo n.º 4
0
        public static void ExportDatabaseToFile(this DbContext ctx, String filename)
        {
            ObjectContext octx = (ctx as IObjectContextAdapter).ObjectContext;

            File.WriteAllText(filename, octx.CreateDatabaseScript());
        }