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(); }