示例#1
0
        public DocumentSchemaWithOverridenDefaultSchemaAndEventsTests()
        {
            StoreOptions(_ =>
            {
                #region sample_override_schema_name

                _.DatabaseSchemaName = "other";

                #endregion sample_override_schema_name

                _.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.ToDatabaseScript();

            using (var session = theStore.OpenSession())
            {
                session.Store(new User());
                session.Store(new Issue());
                session.Store(new Company());
                session.SaveChanges();
            }

            _tables    = theStore.Tenancy.Default.SchemaTables().GetAwaiter().GetResult().ToArray();
            _functions = theStore.Tenancy.Default.Functions().GetAwaiter().GetResult().ToArray();
        }
示例#2
0
        public DocumentSchemaWithOverridenSchemaTests()
        {
            #region 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 = DbObjectName.DefaultDatabaseSchemaName;
            });

            #endregion sample_override_schema_per_table

            _schema = theStore.Schema;
            _sql    = _schema.ToDatabaseScript();

            using (var session = theStore.OpenSession())
            {
                session.Store(new User());
                session.Store(new Issue());
                session.Store(new Company());
                session.SaveChanges();
            }

            _tables    = theStore.Tenancy.Default.SchemaTables().GetAwaiter().GetResult().ToArray();
            _functions = theStore.Tenancy.Default.Functions().GetAwaiter().GetResult().ToArray();
        }
示例#3
0
 public void do_write_the_event_sql_if_the_event_graph_is_active()
 {
     theStore.Events.IsActive(null).ShouldBeTrue();
     _schema.ToDatabaseScript().ShouldContain("other.mt_streams");
 }