Пример #1
0
 public RelationDescription(LinkTarget left, LinkTarget right, TableDescription table, EntityDescription underlyingEntity, bool disabled)
 {
     _table            = table;
     _underlyingEntity = underlyingEntity;
     _left             = left;
     _right            = right;
     _disabled         = disabled;
 }
Пример #2
0
 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;
 }
Пример #3
0
 public EntityDescription(string id, string name, string nameSpace, string description, OrmObjectsDef ormObjectsDef, EntityDescription baseEntity, EntityBehaviuor behaviour)
 {
     _id                   = id;
     _name                 = name;
     _description          = description;
     _tables               = new List <TableDescription>();
     _properties           = new List <PropertyDescription>();
     _suppressedProperties = new List <PropertyDescription>();
     _ormObjectsDef        = ormObjectsDef;
     _namespace            = nameSpace;
     _baseEntity           = baseEntity;
     _behaviour            = behaviour;
 }
Пример #4
0
 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;
 }
Пример #5
0
 protected TypeDescription(string id, string typeName, EntityDescription entity, bool treatAsUserType, UserTypeHintFlags?userTypeHint)
 {
     _id = id;
     if (!string.IsNullOrEmpty(typeName))
     {
         if (treatAsUserType)
         {
             _userType    = typeName;
             _userTpeHint = userTypeHint;
         }
         else
         {
             _clrType = GetTypeByName(typeName);
         }
     }
     _entity = entity;
 }
Пример #6
0
 public RelationDescription(LinkTarget left, LinkTarget right, TableDescription table, EntityDescription underlyingEntity)
     : this(left, right, table, underlyingEntity, false)
 {
 }
Пример #7
0
 public LinkTarget(EntityDescription entity, string fieldName, bool cascadeDelete)
 {
     _entity        = entity;
     _fieldName     = fieldName;
     _cascadeDelete = cascadeDelete;
 }
Пример #8
0
 public EntityDescription(string id, string name, string nameSpace, string description, OrmObjectsDef ormObjectsDef, EntityDescription baseEntity)
     : this(id, name, nameSpace, description, ormObjectsDef, baseEntity, EntityBehaviuor.Default)
 {
 }
Пример #9
0
        //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);
        }
Пример #10
0
 public TypeDescription(string id, EntityDescription entity)
     : this(id, null, entity, false, null)
 {
 }
Пример #11
0
 public PropertyDescription(EntityDescription entity, string name, string alias, string[] attributes, string description, TypeDescription type, string fieldname, TableDescription table, AccessLevel fieldAccessLevel, AccessLevel propertyAccessLevel)
     : this(entity, name, alias, attributes, description, type, fieldname, table, false, fieldAccessLevel, propertyAccessLevel, false, false)
 {
 }
Пример #12
0
 public PropertyDescription(EntityDescription entity, string name)
     : this(entity, name, null, null, null, null, null, null, false, default(AccessLevel), default(AccessLevel), true, false)
 {
 }