public MartenRegistryTests() { var storeOptions = new StoreOptions(); storeOptions.Schema.Include<TestRegistry>(); theSchema = new DocumentSchema(storeOptions, new ConnectionSource(), new NulloMartenLogger()); }
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(); }); }
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"); }
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"); }
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); }
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()); }
public DocumentCleaner(IConnectionFactory factory, DocumentSchema schema) { _factory = factory; _schema = schema; }
public DbObjects(IConnectionFactory factory, DocumentSchema schema) { _factory = factory; _schema = schema; }
public DocumentSchemaTests() { ConnectionSource.CleanBasicDocuments(); _schema = _container.GetInstance<DocumentSchema>(); }
public SchemaPatch(DocumentSchema schema) : this(schema.StoreOptions.DdlRules, schema) { }
public MartenRegistryTests() { theSchema = Container.For<DevelopmentModeRegistry>().GetInstance<DocumentSchema>(); theSchema.Alter<TestRegistry>(); }