예제 #1
0
        internal InstanceDescription(object instance)
        {
            _describedInstance = instance;
            _objectDescription = ClassFactory.GetObjectDescription(_describedInstance.GetType(),
                                                                   ClassFactory.CreatePersistentStorage("Default"));

            _isEntity     = _objectDescription.IsEntity;
            _isEntityBase = _objectDescription.IsDescendentFrom(typeof(EntityBase));
        }
예제 #2
0
        internal PropertyDescription(ObjectDescription objectDescription, PropertyInfo property, Configuration.EntityPropertyConfiguration epc)
        {
            _property = property;
            CreateAttributeArray();
            if (epc != null && epc.Attributes.Count > 0)
            {
            }
            else
            {
                foreach (Attribute attr in _attrs)
                {
                    if (attr is InternalAttribute)
                    {
                        _isInternal = true;
                    }
                    if (attr is RelationAttribute)
                    {
                        _isRelation        = true;
                        _relationAttribute = (RelationAttribute)attr;
                        if ((attr as RelationAttribute).RelationType == RelationType.OneToOne)
                        {
                            _isOneToOneRelation = true;
                        }
                        if ((attr as RelationAttribute).RelationType == RelationType.OneToMany)
                        {
                            _isOneToManyRelation = true;
                        }
                        if ((attr as RelationAttribute).RelationType == RelationType.ManyToMany)
                        {
                            _isManyToManyRelation = true;
                        }
                        _relatedType = _relationAttribute.RelatedType;
                    }
                    if (attr is ReadOnlyFieldAttribute)
                    {
                        _isReadOnly = true;
                    }
                    if (attr is NonPersistentAttribute)
                    {
                        _isNonPersistent = true;
                    }
                    if (attr is ObligatoryFieldAttribute)
                    {
                        _isObligatory = true;
                    }
                    if (attr is CaptionAttribute)
                    {
                        _caption = (attr as CaptionAttribute).Caption;
                    }
                }
            }

            if (_property.GetCustomAttributes(typeof(IdFieldAttribute), true) != null && _property.GetCustomAttributes(typeof(IdFieldAttribute), true).Length > 0)
            {
                _isId = true;
            }
            else
            {
                _isId = false;
            }
            foreach (Attribute attr in objectDescription.ObjectType.GetCustomAttributes(typeof(IdFieldNameAttribute), true))
            {
                _isId = (attr as IdFieldNameAttribute).Name == Name;
            }

            _reflectedObject = objectDescription;
            if (IsReadOnly)
            {
                _isObligatory = true;
            }
            if (string.IsNullOrEmpty(_caption))
            {
                _caption = Name;
            }

            _propertyDefaultValue = GetDefaultValue(PropertyType);
        }
예제 #3
0
 internal PropertyDescriptionCollection(ObjectDescription owner)
 {
     _owner = owner;
 }