Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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)), }));
        }
Ejemplo n.º 4
0
 public string DocumentStorageCodeFor <T>()
 {
     return(DocumentStorageBuilder.GenerateDocumentStorageCode(new[] { _schema.MappingFor(typeof(T)) }));
 }
Ejemplo n.º 5
0
        public void WriteStorageCode(string file)
        {
            var code = DocumentStorageBuilder.GenerateDocumentStorageCode(Options.AllDocumentMappings.ToArray());

            new FileSystem().WriteStringToFile(file, code);
        }