public void do_not_blow_up_building_one() { var storage = DocumentStorageBuilder.Build(null, new DocumentMapping(typeof(User))); storage.ShouldNotBeNull(); storage.IdType.ShouldBe(NpgsqlDbType.Uuid); }
public void implements_the_id_type() { DocumentStorageBuilder.Build(null, new DocumentMapping(typeof(User))).IdType.ShouldBe(NpgsqlDbType.Uuid); var schema = Container.For <DevelopmentModeRegistry>().GetInstance <IDocumentSchema>(); DocumentStorageBuilder.Build(schema, typeof(IntDoc)).IdType.ShouldBe(NpgsqlDbType.Integer); DocumentStorageBuilder.Build(schema, typeof(LongDoc)).IdType.ShouldBe(NpgsqlDbType.Bigint); DocumentStorageBuilder.Build(null, typeof(StringDoc)).IdType.ShouldBe(NpgsqlDbType.Text); }
public void generate_code() { var mapping = new DocumentMapping(typeof(Target)); mapping.DuplicateField("Number"); mapping.DuplicateField("Date"); var code = DocumentStorageBuilder.GenerateDocumentStorageCode(new[] { mapping }); Debug.WriteLine(code); }
public string DocumentStorageCodeFor <T>() { var documentMapping = _schema.MappingFor(typeof(T)); if (documentMapping is DocumentMapping) { return(DocumentStorageBuilder.GenerateDocumentStorageCode(new[] { documentMapping.As <DocumentMapping>() })); } return($"Docuemnt Storage for {typeof (T).FullName} is not generated"); }
public void do_not_blow_up_building_more_than_one() { var mappings = new[] { new DocumentMapping(typeof(User)), new DocumentMapping(typeof(Company)), new DocumentMapping(typeof(Issue)) }; DocumentStorageBuilder.Build(null, mappings).Count() .ShouldBe(3); }
public void implements_the_identity_method() { var schema = Container.For <DevelopmentModeRegistry>().GetInstance <IDocumentSchema>(); var guid = Guid.NewGuid(); DocumentStorageBuilder.Build(schema, typeof(IntDoc)).Identity(new IntDoc { Id = 3 }).ShouldBe(3); DocumentStorageBuilder.Build(schema, typeof(LongDoc)).Identity(new LongDoc { Id = 4 }).ShouldBe(4L); DocumentStorageBuilder.Build(null, typeof(StringDoc)).Identity(new StringDoc { Id = "abc" }).ShouldBe("abc"); DocumentStorageBuilder.Build(null, typeof(User)).Identity(new User { Id = guid }).ShouldBe(guid); }
public void load_with_small_batch() { // SAMPLE: using_bulk_insert // This is just creating some randomized // document data var data = Target.GenerateRandomData(100).ToArray(); // Load all of these into a Marten-ized database theStore.BulkInsert(data); // And just checking that the data is actually there;) theSession.Query <Target>().Count().ShouldBe(data.Length); // ENDSAMPLE theSession.Load <Target>(data[0].Id).ShouldNotBeNull(); Debug.WriteLine(DocumentStorageBuilder.GenerateDocumentStorageCode(new DocumentMapping[] { new DocumentMapping(typeof(Target)), })); }
public void generates_the_resolve_method() { var storage = DocumentStorageBuilder.Build(null, DocumentMapping.For <User>()); storage.ShouldBeAssignableTo <IResolver <User> >(); }
public string DocumentStorageCodeFor <T>() { return(DocumentStorageBuilder.GenerateDocumentStorageCode(new[] { _schema.MappingFor(typeof(T)) })); }
public void do_not_blow_up_building_one() { var storage = DocumentStorageBuilder.Build(new DocumentMapping(typeof(User))); storage.ShouldNotBeNull(); }
public void WriteStorageCode(string file) { var code = DocumentStorageBuilder.GenerateDocumentStorageCode(Options.AllDocumentMappings.ToArray()); new FileSystem().WriteStringToFile(file, code); }
public void generate_document_storage_code_for_the_hierarchy_without_blowing_up() { DocumentStorageBuilder.Build(null, theHierarchy).ShouldNotBeNull(); }