Exemplo n.º 1
0
        public List <SelfRelationDefinition> GetM2MSelfRelations(bool withDisabled)
        {
            List <SelfRelationDefinition> l = new List <SelfRelationDefinition>();

            foreach (RelationDefinitionBase rel in _model.GetRelations())
            {
                SelfRelationDefinition match = rel as SelfRelationDefinition;
                if (match != null && (match.IsEntityTakePart(this)) &&
                    (!match.Disabled || withDisabled))
                {
                    l.Add(match);
                }
            }
            Dictionary <string, int> relationUniques = new Dictionary <string, int>();

            FillUniqueRelations(l, relationUniques);
            if (BaseEntity != null)
            {
                var baseEntityRealation = BaseEntity.GetM2MRelations(withDisabled);
                FillUniqueRelations(baseEntityRealation, relationUniques);
            }
            foreach (var relationUnique in relationUniques)
            {
                if (relationUnique.Value > 1)
                {
                    throw new WXMLException("Существуют дублирующиеся M2M связи." + relationUnique.Key);
                }
            }
            return(l);
        }
 protected bool _Similar(SelfRelationDefinition obj)
 {
     return(base.Similar(obj) && _entity.Name == obj._entity.Name);
 }
 public bool Similar(SelfRelationDefinition obj)
 {
     return(_Similar(obj));
 }