コード例 #1
0
ファイル: MartenRegistryTests.cs プロジェクト: nieve/marten
        public MartenRegistryTests()
        {
            var storeOptions = new StoreOptions();
            storeOptions.Schema.Include<TestRegistry>();

            theSchema = new DocumentSchema(storeOptions, new ConnectionSource(), new NulloMartenLogger());
        }
コード例 #2
0
 public void should_get_foreign_key_from_attribute()
 {
     var schema = new DocumentSchema(new StoreOptions(), null, null);
     schema.MappingFor(typeof (Issue))
         .As<DocumentMapping>()
         .ForeignKeys
         .ShouldContain(x => x.ColumnName == "user_id");
 }
 public void cannot_use_a_doc_type_with_no_id()
 {
     Exception<InvalidDocumentException>.ShouldBeThrownBy(() =>
     {
         var schema = new DocumentSchema(new StoreOptions(), null, null);
         schema.MappingFor(typeof(BadDoc)).ShouldBeNull();
     });
     
 }
コード例 #4
0
        public void can_override_with_MartenRegistry()
        {
            var storeOptions = new StoreOptions();
            storeOptions.Schema.For<Organization>().Duplicate(x => x.Time2, pgType: "timestamp");

            var schema = new DocumentSchema(storeOptions, null, new NulloMartenLogger());

            schema.MappingFor(typeof(Organization)).As<DocumentMapping>().DuplicatedFields.Single(x => x.MemberName == "Time2")
                .PgType.ShouldBe("timestamp");
        }
コード例 #5
0
        public void can_override_with_MartenRegistry()
        {
            var registry = new MartenRegistry();
            registry.For<Organization>().Searchable(x => x.Time2, pgType:"timestamp");

            var schema = new DocumentSchema(new StoreOptions(), null, null);
            schema.Alter(registry);

            schema.MappingFor(typeof(Organization)).DuplicatedFields.Single(x => x.MemberName == "Time2")
                .PgType.ShouldBe("timestamp");
        }
コード例 #6
0
        public void should_get_foreign_key_from_registry()
        {
            var storeOptions = new StoreOptions();
            storeOptions.Schema.For<Issue>().ForeignKey<User>(i => i.OtherUserId);

            var schema = new DocumentSchema(storeOptions, null, null);

            schema.MappingFor(typeof(Issue))
                .As<DocumentMapping>()
                .ForeignKeys
                .ShouldContain(x => x.ColumnName == "other_user_id");
        }
        public when_deriving_the_table_definition_from_the_database_schema_Tests()
        {
            ConnectionSource.CleanBasicDocuments();
            _schema = _container.GetInstance<DocumentSchema>();

            theMapping = _schema.MappingFor(typeof(User));
            theMapping.DuplicateField("UserName");


            _storage = _schema.StorageFor(typeof(User));

            theDerivedTable = _schema.TableSchema(theMapping.TableName);
        }
コード例 #8
0
ファイル: DocumentSchemaTests.cs プロジェクト: jjchiw/Marten
        public void builds_schema_objects_on_the_fly_as_needed()
        {
            _schema.StorageFor(typeof (User)).ShouldNotBeNull();
            _schema.StorageFor(typeof (Issue)).ShouldNotBeNull();
            _schema.StorageFor(typeof (Company)).ShouldNotBeNull();

            var schema = new DocumentSchema(new ConnectionSource(), new DevelopmentSchemaCreation(new ConnectionSource()));
            var tables = schema.SchemaTableNames();
            tables.ShouldContain(DocumentMapping.TableNameFor(typeof (User)).ToLower());
            tables.ShouldContain(DocumentMapping.TableNameFor(typeof (Issue)).ToLower());
            tables.ShouldContain(DocumentMapping.TableNameFor(typeof (Company)).ToLower());

            var functions = schema.SchemaFunctionNames();
            functions.ShouldContain(DocumentMapping.UpsertNameFor(typeof (User)).ToLower());
            functions.ShouldContain(DocumentMapping.UpsertNameFor(typeof (Issue)).ToLower());
            functions.ShouldContain(DocumentMapping.UpsertNameFor(typeof (Company)).ToLower());
        }
コード例 #9
0
ファイル: DocumentCleaner.cs プロジェクト: jtanus/pg-marten
 public DocumentCleaner(IConnectionFactory factory, DocumentSchema schema)
 {
     _factory = factory;
     _schema  = schema;
 }
コード例 #10
0
ファイル: DbObjects.cs プロジェクト: modulexcite/marten
 public DbObjects(IConnectionFactory factory, DocumentSchema schema)
 {
     _factory = factory;
     _schema  = schema;
 }
コード例 #11
0
ファイル: DbObjects.cs プロジェクト: phillip-haydon/marten
 public DbObjects(IConnectionFactory factory, DocumentSchema schema)
 {
     _factory = factory;
     _schema = schema;
 }
コード例 #12
0
ファイル: DocumentSchemaTests.cs プロジェクト: jjchiw/Marten
 public DocumentSchemaTests()
 {
     ConnectionSource.CleanBasicDocuments();
     _schema = _container.GetInstance<DocumentSchema>();
 }
コード例 #13
0
 public SchemaPatch(DocumentSchema schema) : this(schema.StoreOptions.DdlRules, schema)
 {
 }
コード例 #14
0
        public MartenRegistryTests()
        {
            theSchema = Container.For<DevelopmentModeRegistry>().GetInstance<DocumentSchema>();

            theSchema.Alter<TestRegistry>();
        }
コード例 #15
0
 public DocumentCleaner(IConnectionFactory factory, DocumentSchema schema)
 {
     _factory = factory;
     _schema = schema;
 }
コード例 #16
0
ファイル: SchemaPatch.cs プロジェクト: phillip-haydon/marten
 public SchemaPatch(DocumentSchema schema) : this(schema.StoreOptions.DdlRules, schema)
 {
     
 }