public DocumentSchemaWithOverridenDefaultSchemaAndEventsTests() { StoreOptions(_ => { // SAMPLE: override_schema_name _.DatabaseSchemaName = "other"; // ENDSAMPLE _.Storage.MappingFor(typeof(User)).DatabaseSchemaName = "yet_another"; _.Storage.MappingFor(typeof(Issue)).DatabaseSchemaName = "overriden"; _.Storage.MappingFor(typeof(Company)); _.Events.AddEventType(typeof(MembersJoined)); }); _schema = theStore.Schema; _sql = _schema.ToDDL(); using (var session = theStore.OpenSession()) { session.Store(new User()); session.Store(new Issue()); session.Store(new Company()); session.SaveChanges(); } _tables = _schema.DbObjects.SchemaTables(); _functions = _schema.DbObjects.Functions(); }
public DocumentSchemaWithOverridenSchemaTests() { // SAMPLE: override_schema_per_table StoreOptions(_ => { _.Storage.MappingFor(typeof(User)).DatabaseSchemaName = "other"; _.Storage.MappingFor(typeof(Issue)).DatabaseSchemaName = "overriden"; _.Storage.MappingFor(typeof(Company)); _.Storage.MappingFor(typeof(IntDoc)); // this will tell marten to use the default 'public' schema name. _.DatabaseSchemaName = Marten.StoreOptions.DefaultDatabaseSchemaName; }); // ENDSAMPLE _schema = theStore.Schema; _sql = _schema.ToDDL(); using (var session = theStore.OpenSession()) { session.Store(new User()); session.Store(new Issue()); session.Store(new Company()); session.SaveChanges(); } _tables = _schema.DbObjects.SchemaTables(); _functions = _schema.DbObjects.Functions(); }
public void do_write_the_event_sql_if_the_event_graph_is_active() { theStore.Events.IsActive.ShouldBeTrue(); _schema.ToDDL().ShouldContain("other.mt_streams"); }
public DocumentSchemaWithOverridenDefaultSchemaAndEventsTests() { StoreOptions(_ => { // SAMPLE: override_schema_name _.DatabaseSchemaName = "other"; // ENDSAMPLE _.MappingFor(typeof(User)).DatabaseSchemaName = "yet_another"; _.MappingFor(typeof(Issue)).DatabaseSchemaName = "overriden"; _.MappingFor(typeof(Company)); _.Events.AddEventType(typeof(MembersJoined)); }); _schema = theStore.Schema; _sql = _schema.ToDDL(); using (var session = theStore.OpenSession()) { session.Store(new User()); session.Store(new Issue()); session.Store(new Company()); session.SaveChanges(); } _tables = _schema.DbObjects.SchemaTables(); _functions = _schema.DbObjects.SchemaFunctionNames(); }
public DocumentSchemaWithOverridenSchemaTests() { // SAMPLE: override_schema_per_table StoreOptions(_ => { _.MappingFor(typeof(User)).DatabaseSchemaName = "other"; _.MappingFor(typeof(Issue)).DatabaseSchemaName = "overriden"; _.MappingFor(typeof(Company)); // this will tell marten to use the default 'public' schema name. _.DatabaseSchemaName = Marten.StoreOptions.DefaultDatabaseSchemaName; }); // ENDSAMPLE _schema = theStore.Schema; _sql = _schema.ToDDL(); using (var session = theStore.OpenSession()) { session.Store(new User()); session.Store(new Issue()); session.Store(new Company()); session.SaveChanges(); } _tables = _schema.DbObjects.SchemaTables(); _functions = _schema.DbObjects.SchemaFunctionNames(); }
public void do_write_the_event_sql_if_the_event_graph_is_active() { theStore.Events.IsActive(null).ShouldBeTrue(); SpecificationExtensions.ShouldContain(_schema.ToDDL(), "other.mt_streams"); }
public DocumentSchemaWithOverridenSchemaTests() { StoreOptions(_ => { _.MappingFor(typeof(User)).DatabaseSchemaName = "other"; _.MappingFor(typeof(Issue)).DatabaseSchemaName = "overriden"; _.MappingFor(typeof(Company)); _.DatabaseSchemaName = Marten.StoreOptions.DefaultDatabaseSchemaName; }); _schema = theStore.Schema; _sql = _schema.ToDDL(); using (var session = theStore.OpenSession()) { session.Store(new User()); session.Store(new Issue()); session.Store(new Company()); session.SaveChanges(); } _tables = _schema.SchemaTableNames(); _functions = _schema.SchemaFunctionNames(); }