Esempio n. 1
0
        private object GetPropertyValue(ORMProperty property, T instance)
        {
            foreach (var propertyInfo in typeof(T).GetProperties())
            {
                ORMProperty[] props = (ORMProperty[])propertyInfo.GetCustomAttributes(typeof(ORMProperty), false);
                foreach (ORMProperty ormProperty in props)
                {
                    if (ormProperty.FieldName.Equals(property.FieldName))
                    {
                        return(propertyInfo.GetValue(instance));
                    }
                }
            }

            return(-1);
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize the instance data.
        /// </summary>
        private void Initialize(PropertyInfo property, ORMProperty attribute)
        {
            this.Property  = property;
            this.Attribute = attribute;
            this.OwnerType = this.Property.DeclaringType;

            this.IsFileField         = (this.Attribute is ORMPropertyFile);
            this.IsForeignField      = this.IsOrmInstance(this.Property.PropertyType);
            this.IsForeignCollection = (this.Attribute is ORMForeignCollection);
            this.IsPrimaryKey        = (this.Attribute is ORMPrimaryKey);
            this.IsField             = !this.IsForeignField && !this.IsForeignCollection && !this.IsPrimaryKey && !this.IsFileField;

            if (this.IsForeignCollection)
            {
                this.ForeignCollectionType   = this.Property.PropertyType.GetGenericArguments()[0];
                this.ForeignCollectionMember = this.GetForeignFieldMember(this.ForeignCollectionType);
            }
        }