public void Setup()
        {
            // Setup Database
            database = new Database("DB1");
            var table = new Table("User");

            table.AddColumn(new Column("Name"));
            table.AddColumn(new Column("AddressStreet"));
            table.AddColumn(new Column("AddressCity"));
            table.AddColumn(new Column("AddressCountry"));
            database.AddTable(table);

            // Setup Entities
            entitySet = new EntitySetImpl();
            Entity userEntity = new EntityImpl("User");

            userEntity.AddProperty(new PropertyImpl("Name"));

            // Create the Address type
            spec = new ComponentSpecificationImpl("Address");

            spec.AddProperty(new ComponentPropertyImpl("Street"));
            spec.AddProperty(new ComponentPropertyImpl("City"));
            spec.AddProperty(new ComponentPropertyImpl("Country"));

            // Create the Address component for the User entity.
            component = spec.CreateImplementedComponentFor(userEntity, "HomeAddress");

            entitySet.AddEntity(userEntity);
            entitySet.AddComponentSpecification(spec);

            // Setup the Mappings
            mappingSet       = new MappingSetImpl(database, entitySet);
            componentMapping = new ComponentMappingImpl();
            mappingSet.AddMapping(componentMapping);

            componentMapping.AddPropertyAndColumn(component.Properties[0], table.Columns[1]);
            componentMapping.AddPropertyAndColumn(component.Properties[1], table.Columns[2]);
            componentMapping.AddPropertyAndColumn(component.Properties[2], table.Columns[3]);

            // Add the mapping between the Name property and the Name column in the database table.
            mappingSet.ChangeMappedColumnFor(userEntity.ConcreteProperties[0]).To(table.Columns[0]);
        }
        public void Setup()
        {
            // Setup Database
            database = new Database("DB1");
            var table = new Table("User");
            table.AddColumn(new Column("Name"));
            table.AddColumn(new Column("AddressStreet"));
            table.AddColumn(new Column("AddressCity"));
            table.AddColumn(new Column("AddressCountry"));
            database.AddTable(table);

            // Setup Entities
            entitySet = new EntitySetImpl();
            Entity userEntity = new EntityImpl("User");
            userEntity.AddProperty(new PropertyImpl("Name"));

            // Create the Address type
            spec = new ComponentSpecificationImpl("Address");

            spec.AddProperty(new ComponentPropertyImpl("Street"));
            spec.AddProperty(new ComponentPropertyImpl("City"));
            spec.AddProperty(new ComponentPropertyImpl("Country"));

            // Create the Address component for the User entity.
            component = spec.CreateImplementedComponentFor(userEntity, "HomeAddress");

            entitySet.AddEntity(userEntity);
            entitySet.AddComponentSpecification(spec);

            // Setup the Mappings
            mappingSet = new MappingSetImpl(database, entitySet);
            componentMapping = new ComponentMappingImpl();
            mappingSet.AddMapping(componentMapping);

            componentMapping.AddPropertyAndColumn(component.Properties[0], table.Columns[1]);
            componentMapping.AddPropertyAndColumn(component.Properties[1], table.Columns[2]);
            componentMapping.AddPropertyAndColumn(component.Properties[2], table.Columns[3]);

            // Add the mapping between the Name property and the Name column in the database table.
            mappingSet.ChangeMappedColumnFor(userEntity.ConcreteProperties[0]).To(table.Columns[0]);
        }