public static EF6Model CreateWithFileMapping(ContentAccess contentAccess, string path, SqlConnection connection, bool contextOwnsConnection)
        {
            var schemaProvider = new FileSchemaProvider(path);
            var configurator   = new MappingConfigurator(contentAccess, schemaProvider);

            return(Create(configurator, connection, contextOwnsConnection));
        }
Ejemplo n.º 2
0
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            var schemaProvider = new StaticSchemaProvider();
            var mapping        = new MappingConfigurator(DefaultContentAccess, schemaProvider);

            mapping.OnModelCreating(modelBuilder);
        }
        public static EF6Model CreateWithDatabaseMapping(ContentAccess contentAccess, string siteName, SqlConnection connection, bool contextOwnsConnection)
        {
            var schemaProvider = new DatabaseSchemaProvider(siteName, connection);
            var configurator   = new MappingConfigurator(contentAccess, schemaProvider);
            var context        = Create(configurator, connection, contextOwnsConnection);

            context.SiteName = siteName;
            return(context);
        }