Ejemplo n.º 1
0
 static Func <object, object?>[] ModifiableFieldGetters(Type type)
 {
     lock (getterCache)
         return(getterCache.GetOrCreate(type, () =>
         {
             FieldInfo[] aux = Reflector.InstanceFieldsInOrder(type);
             return aux.Where(fi => Reflector.IsModifiableIdentifiableOrLite(fi.FieldType) && !IsIgnored(fi))
             .Select(fi => ReflectionTools.CreateGetterUntyped(type, fi) !).ToArray();
         }));
Ejemplo n.º 2
0
        static TypeAttributePack?GetFieldsAndProperties(Type type)
        {
            lock (fieldAndProperties)
            {
                return(fieldAndProperties.GetOrCreate(type, () =>
                {
                    var list = Reflector.InstanceFieldsInOrder(type).Where(fi => fi.HasAttribute <T>() || (Reflector.TryFindPropertyInfo(fi)?.HasAttribute <T>() ?? false)).ToList();

                    if (list.Count == 0)
                    {
                        return null;
                    }

                    return new TypeAttributePack(
                        fields: list.Select(fi => ReflectionTools.CreateGetterUntyped(type, fi) !).ToArray(),
                        propertyNames: list.Select(fi => Reflector.FindPropertyInfo(fi).Name).ToArray()
                        );
                }));
Ejemplo n.º 3
0
 public PropertyConverter(Type type, IPropertyValidator pv)
 {
     this.PropertyValidator = pv;
     GetValue = ReflectionTools.CreateGetterUntyped(type, pv.PropertyInfo);
     SetValue = ReflectionTools.CreateSetterUntyped(type, pv.PropertyInfo);
 }
Ejemplo n.º 4
0
        //public Action<object, object> Setter { get; private set; }

        public EntityField(Type type, FieldInfo fi)
        {
            FieldInfo = fi;
            Getter    = ReflectionTools.CreateGetterUntyped(type, fi);
            //Setter = ReflectionTools.CreateSetterUntyped(type, fi);
        }