Ejemplo n.º 1
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.º 2
0
        internal virtual void RegisterForLinqSearching(DocumentMapping mapping)
        {
            if (!Enabled || Member == null)
            {
                return;
            }



            mapping.DuplicateField(new MemberInfo[] { Member }, columnName: Name)
            .OnlyForSearching = true;
        }
        public when_deriving_the_table_definition_from_the_database_schema_Tests()
        {
            _schema = theStore.Schema;

            theMapping = theStore.Tenancy.Default.MappingFor(typeof(User)).As <DocumentMapping>();
            theMapping.DuplicateField("UserName");


            _storage = theStore.Tenancy.Default.StorageFor(typeof(User));

            theDerivedTable = new DocumentTable(theMapping);
        }
        public when_deriving_the_table_definition_from_the_database_schema_Tests()
        {
            _schema = theStore.Schema;

            theMapping = _schema.MappingFor(typeof(User)).As <DocumentMapping>();
            theMapping.DuplicateField("UserName");


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

            theDerivedTable = _schema.DbObjects.TableSchema(theMapping);
        }
Ejemplo n.º 5
0
        public void duplicated_field_date_time_db_type_should_be_taken_from_store_options_useTimestampWithoutTimeZoneForDateTime(bool useTimestampWithoutTimeZoneForDateTime, NpgsqlDbType expectedNpgsqlDbType)
        {
            var storeOptions = new StoreOptions();

            storeOptions.DuplicatedFieldUseTimestampWithoutTimeZoneForDateTime = useTimestampWithoutTimeZoneForDateTime;

            var mapping = new DocumentMapping <Target>(storeOptions);

            var duplicatedField = mapping.DuplicateField(nameof(Target.Date));

            duplicatedField.DbType.ShouldBe(expectedNpgsqlDbType);
        }
Ejemplo n.º 6
0
        public void duplicated_field_enum_storage_should_be_taken_from_store_options_duplicated_field_enum_storage_when_it_was_changed(EnumStorage enumStorage, NpgsqlDbType expectedNpgsqlDbType)
        {
            var storeOptions = new StoreOptions();

            storeOptions.DuplicatedFieldEnumStorage = enumStorage;

            var mapping = new DocumentMapping <Target>(storeOptions);

            var duplicatedField = mapping.DuplicateField(nameof(Target.Color));

            duplicatedField.DbType.ShouldBe(expectedNpgsqlDbType);
        }
Ejemplo n.º 7
0
        public void duplicated_field_enum_storage_should_be_taken_from_store_options_enum_storage_by_default(EnumStorage enumStorage, NpgsqlDbType expectedNpgsqlDbType)
        {
            var storeOptions = new StoreOptions();

            storeOptions.UseDefaultSerialization(enumStorage);

            var mapping = new DocumentMapping <Target>(storeOptions);

            var duplicatedField = mapping.DuplicateField(nameof(Target.Color));

            duplicatedField.DbType.ShouldBe(expectedNpgsqlDbType);
        }
        public when_deriving_the_table_definition_from_the_database_schema_Tests()
        {
            ConnectionSource.CleanBasicDocuments();
            _schema = _container.GetInstance <DocumentSchema>();

            theMapping = _schema.MappingFor(typeof(User)).As <DocumentMapping>();
            theMapping.DuplicateField("UserName");


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

            theDerivedTable = _schema.TableSchema(theMapping.TableName);
        }