Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 public void do_write_the_event_sql_if_the_event_graph_is_active()
 {
     theStore.Events.IsActive.ShouldBeTrue();
     _schema.ToDDL().ShouldContain("other.mt_streams");
 }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
 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");
 }
Exemplo n.º 7
0
        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();
        }