//public string QualifiedIdentifier //{ // get // { // return // (OrmObjectsDef != null && !string.IsNullOrEmpty(OrmObjectsDef.NS)) // ? OrmObjectsDef.NS + ":" + Identifier // : Identifier; // } //} private static EntityDescription MergeEntities(EntityDescription oldOne, EntityDescription newOne) { EntityDescription resultOne = new EntityDescription(newOne.Identifier, newOne.Name, newOne.Namespace, newOne.Description, newOne.OrmObjectsDef); //добавляем новые таблички foreach (TableDescription newTable in newOne.Tables) { resultOne.Tables.Add(newTable); } // добавляем новые проперти foreach (PropertyDescription newProperty in newOne.Properties) { PropertyDescription prop = newProperty.CloneSmart(); if (newOne.SuppressedProperties.Exists(delegate(PropertyDescription match) { return(match.Name == newProperty.Name); })) { prop.IsSuppressed = true; } resultOne.Properties.Add(prop); } foreach (PropertyDescription newProperty in newOne.SuppressedProperties) { PropertyDescription prop = newProperty.CloneSmart(); resultOne.SuppressedProperties.Add(prop); } if (oldOne != null) { // добавляем старые таблички, если нужно foreach (TableDescription oldTable in oldOne.Tables) { if (!resultOne.Tables.Exists(delegate(TableDescription tableMatch) { return(oldTable.Name == tableMatch.Name); })) { resultOne.Tables.Add(oldTable); } } foreach (PropertyDescription oldProperty in oldOne.SuppressedProperties) { PropertyDescription prop = oldProperty.CloneSmart(); resultOne.SuppressedProperties.Add(prop); } // добавляем старые проперти, если нужно foreach (PropertyDescription oldProperty in oldOne.Properties) { PropertyDescription newProperty = resultOne.GetProperty(oldProperty.Name); if (newProperty == null) { TableDescription newTable = resultOne.GetTable(oldProperty.Table.Identifier); TypeDescription newType = oldProperty.PropertyType; bool isSuppressed = resultOne.SuppressedProperties.Exists(delegate(PropertyDescription match) { return(match.Name == oldProperty.Name); }); bool isRefreshed = false; bool fromBase = true; if (newType.IsEntityType) { EntityDescription newEntity = resultOne.OrmObjectsDef.Entities.Find(delegate(EntityDescription matchEntity) { return(matchEntity.BaseEntity != null && matchEntity.BaseEntity.Identifier == newType.Entity.Identifier); }); if (newEntity != null) { newType = new TypeDescription(newType.Identifier, newEntity); isRefreshed = true; } } resultOne.Properties.Insert(resultOne.Properties.Count - newOne.Properties.Count, new PropertyDescription(resultOne, oldProperty.Name, oldProperty.PropertyAlias, oldProperty.Attributes, oldProperty.Description, newType, oldProperty.FieldName, newTable, fromBase, oldProperty.FieldAccessLevel, oldProperty.PropertyAccessLevel, isSuppressed, isRefreshed)); } } } return(resultOne); }
public PropertyDescription(string name, string alias, string[] attributes, string description, TypeDescription type, string fieldname, TableDescription table, AccessLevel fieldAccessLevel, AccessLevel propertyAccessLevel) : this(null, name, alias, attributes, description, type, fieldname, table, false, fieldAccessLevel, propertyAccessLevel, false, false) { }
internal PropertyDescription(EntityDescription entity, string name, string alias, string[] attributes, string description, TypeDescription type, string fieldname, TableDescription table, bool fromBase, AccessLevel fieldAccessLevel, AccessLevel propertyAccessLevel, bool isSuppressed, bool isRefreshed) { _name = name; _propertyAlias = alias; _attributes = attributes; _description = description; _type = type; _fieldName = fieldname; _table = table; _fromBase = fromBase; _fieldAccessLevel = fieldAccessLevel; _propertyAccessLevel = propertyAccessLevel; _isSuppressed = isSuppressed; _isRefreshed = isRefreshed; _entity = entity; }
public SelfRelationDescription(EntityDescription entity, SelfRelationTarget direct, SelfRelationTarget reverse, TableDescription table, EntityDescription underlyingEntity, bool disabled) { _entity = entity; _direct = direct; _reverse = reverse; _table = table; _underlyingEntity = underlyingEntity; _disabled = disabled; }