Example #1
0
        public void UpdateAssociation()
        {
            if (typeof(PersistentObject).IsAssignableFrom(OriginalField.PropertyType) || IsList)
            {
                string name = null;

                if (OriginalField.HasCustomAttribute <AssociationAttribute>())
                {
                    name = OriginalField.GetCustomAttribute <AssociationAttribute>().Name;
                }

                ClassWrapper foreignClassWrapper;

                if (!IsList)
                {
                    //foreignClassWrapper = wrappingHandler
                    //.getClassWrapper((Class <? extends PersistentObject >) fieldToWrap.getType
                    foreignClassWrapper = WrappingHandler.GetClassWrapper(OriginalField.PropertyType);
                }
                else
                {
                    // find generic parameter
                    var foreignClass = OriginalField.PropertyType.GetGenericArguments()[0];

                    // find classWrapper
                    foreignClassWrapper = WrappingHandler.GetClassWrapper(foreignClass);
                }

                Association = new AssociationWrapper(foreignClassWrapper, name);
            }
        }
Example #2
0
 public T GetAttribute <T>() where T : Attribute
 {
     return(OriginalField.GetCustomAttribute <T>());
 }