示例#1
0
        private void slyceGrid1_NewRowAdded(out object newObject)
        {
            ComponentPropertyImpl property = new ComponentPropertyImpl("NewProperty")
            {
                Type = "System.String"
            };

            property.ValidationOptions.FractionalDigits = 0;
            property.ValidationOptions.FutureDate       = false;
            property.ValidationOptions.IntegerDigits    = 0;
            property.ValidationOptions.MaximumLength    = 0;
            property.ValidationOptions.MaximumValue     = 0;
            property.ValidationOptions.MinimumLength    = 0;
            property.ValidationOptions.MinimumValue     = 0;
            property.ValidationOptions.NotEmpty         = false;
            property.ValidationOptions.Nullable         = false;
            property.ValidationOptions.PastDate         = false;
            property.ValidationOptions.RegexPattern     = "";
            property.ValidationOptions.Validate         = false;

            ComponentSpecification.AddProperty(property);
            newObject = property;

            AddPropertyToPropertiesGrid(property);

            if (ComponentChanged != null)
            {
                ComponentChanged(ComponentSpecification, null);
            }
        }
        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()
        {
            set = new MappingSetImpl();
            entity = new EntityImpl("Entity1");
            set.EntitySet.AddEntity(entity);
            table = new Table("Table1");
            table.AddColumn(new Column("Street"));
            set.Database.AddTable(table);

            spec = new ComponentSpecificationImpl("Address");
            spec.AddProperty(new ComponentPropertyImpl("Street"));
            set.EntitySet.AddComponentSpecification(spec);

            component = spec.CreateImplementedComponentFor(entity, "HomeAddress");
            set.ChangeMappingFor(component.Properties[0]).To(table.Columns[0]);
        }
        public void Setup()
        {
            set    = new MappingSetImpl();
            entity = new EntityImpl("Entity1");
            set.EntitySet.AddEntity(entity);
            table = new Table("Table1");
            table.AddColumn(new Column("Street"));
            set.Database.AddTable(table);

            spec = new ComponentSpecificationImpl("Address");
            spec.AddProperty(new ComponentPropertyImpl("Street"));
            set.EntitySet.AddComponentSpecification(spec);

            component = spec.CreateImplementedComponentFor(entity, "HomeAddress");
            set.ChangeMappingFor(component.Properties[0]).To(table.Columns[0]);
        }
        public void Setup()
        {
            database  = new Database("Db1");
            entitySet = new EntitySetImpl();

            table = new Table("Table1");
            table.AddColumn(new Column("AddressStreet"));

            var entity1 = new EntityImpl("Entity1");

            componentSpec = new ComponentSpecificationImpl("Address");
            entitySet.AddComponentSpecification(componentSpec);
            componentSpec.AddProperty(new ComponentPropertyImpl("Street"));

            component1 = componentSpec.CreateImplementedComponentFor(entity1, "HomeAddress");
            component2 = componentSpec.CreateImplementedComponentFor(entity1, "WorkAddress");

            database.AddTable(table);
            entitySet.AddEntity(entity1);
        }
        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]);
        }
 void form_CreateNewProperty(object sender, EventArgs e)
 {
     spec.AddProperty(new ComponentPropertyImpl("New_Property"));
 }