Exemplo n.º 1
0
        public void MapBuilder_ShouldOnlyMapSimpleTypes()
        {
            var mapBuilder = new MapBuilder();
            var columns    = mapBuilder.BuildColumnsFromSimpleTypes <EntityWithSimpleAndComplexProperties>();

            Assert.AreEqual(2, columns.MappedColumns.Count);
        }
Exemplo n.º 2
0
        public void MapBuilder_IgnoringAnAlreadyExcludedColumn_ShouldNotThrowAnException()
        {
            var mapBuilder = new MapBuilder();
            var columns    = mapBuilder.BuildColumnsFromSimpleTypes <EntityWithSimpleAndComplexProperties>()
                             .Ignore(e => e.OneToOneChild) // Should already be ignored because it is not a simple type
                             .Ignore(e => e.Collection);   // Should already be ignored because it is an ICollection

            Assert.AreEqual(2, columns.MappedColumns.Count);
        }
Exemplo n.º 3
0
        public void InitMappings()
        {
            MapBuilder builder = new MapBuilder();

            builder.BuildTable <Person>("PersonTable");

            builder.BuildColumnsFromSimpleTypes <Person>()
            .For(p => p.ID)
            .SetPrimaryKey()
            .SetReturnValue()
            .SetAutoIncrement();

            builder.BuildRelationships <Person>();

            builder.BuildColumns <Pet>()
            .For(p => p.ID)
            .SetPrimaryKey()
            .SetAltName("Pet_ID")
            .For(p => p.Name)
            .SetAltName("Pet_Name");
        }
Exemplo n.º 4
0
        public void InitMappings()
        {
            MapBuilder builder = new MapBuilder();

            builder.BuildTable<Person>("PersonTable");

            builder.BuildColumnsFromSimpleTypes<Person>()
                .For(p => p.ID)
                    .SetPrimaryKey()
                    .SetReturnValue()
                    .SetAutoIncrement();

            builder.BuildRelationships<Person>();

            builder.BuildColumns<Pet>()
                .For(p => p.ID)
                    .SetPrimaryKey()
                    .SetAltName("Pet_ID")
                .For(p => p.Name)
                    .SetAltName("Pet_Name");
        }
Exemplo n.º 5
0
        public void MapBuilder_IgnoringAnAlreadyExcludedColumn_ShouldNotThrowAnException()
        {
            var mapBuilder = new MapBuilder();
            var columns = mapBuilder.BuildColumnsFromSimpleTypes<EntityWithSimpleAndComplexProperties>()
                .Ignore(e => e.OneToOneChild) // Should already be ignored because it is not a simple type
                .Ignore(e => e.Collection); // Should already be ignored because it is an ICollection

            Assert.AreEqual(2, columns.MappedColumns.Count);
        }
Exemplo n.º 6
0
        public void MapBuilder_ShouldOnlyMapSimpleTypes()
        {
            var mapBuilder = new MapBuilder();
            var columns = mapBuilder.BuildColumnsFromSimpleTypes<EntityWithSimpleAndComplexProperties>();

            Assert.AreEqual(2, columns.MappedColumns.Count);
        }