Beispiel #1
0
        protected virtual ClassPropertyLocation AddClassProperty(DataSchema dataSchema, PropertyToClass p2c)
        {
            var c = dataSchema.FindClassByID(p2c.ClassID);
            var p = dataSchema.FindPropertyByID(p2c.PropertyID);
            ClassPropertyLocation propLoc = null;

            if (c != null && p != null)
            {
                if (p2c.Location == PropertyValueLocationType.TableColumn)
                {
                    propLoc = new ClassPropertyLocation(c, p, p2c.ColumnName);
                }
                else if (p2c.Location == PropertyValueLocationType.ValueTable)
                {
                    propLoc = new ClassPropertyLocation(c, p);
                }
                else if (p2c.Location == PropertyValueLocationType.Derived)
                {
                    var derivedFromProp = c.FindPropertyByID(p2c.DerivedFromPropertyID);
                    if (derivedFromProp == null)
                    {
                        throw new Exception("Cannot find derived from property ID=" + p2c.DerivedFromPropertyID);
                    }
                    propLoc = new ClassPropertyLocation(c, p, derivedFromProp.GetLocation(c), p2c.DeriveType);
                }
            }
            if (propLoc != null)
            {
                dataSchema.AddClassProperty(propLoc);
            }
            return(propLoc);
        }
 protected virtual void AddClassProperty(DataSchema schema, ClassPropertyLocation pLoc)
 {
     schema.AddClassProperty(pLoc);
 }