示例#1
0
 private PropertyModel(PropertyInfo prop, TypeModel typeModel) : this(prop.Name)
 {
     //TypeModel = typeModel;
     Getter     = prop.GetMethod == null ? null : new MethodModel(prop.GetMethod);
     Setter     = prop.SetMethod == null ? null : new MethodModel(prop.SetMethod);
     Type       = typeModel;
     Attributes = prop.GetCustomAttributes(false).Select(x => TypeModel.GetType(x.GetType())).ToList();
     Access     = SetAccessLevel();
 }
示例#2
0
        private TypeModel EmitReturnType(MethodBase method)
        {
            MethodInfo methodInfo = method as MethodInfo;

            if (methodInfo == null)
            {
                return(null);
            }
            return(TypeModel.GetType(methodInfo.ReturnType));
        }
示例#3
0
        private IEnumerable <TypeModel> EmitAttributes(MethodBase method)
        {
            List <TypeModel> attributes = new List <TypeModel>();

            foreach (var methodAttribute in method.GetCustomAttributes(false))
            {
                attributes.Add(TypeModel.GetType(methodAttribute.GetType()));
            }

            return(attributes);
        }
示例#4
0
 public FieldModel(object[] attributes, string name, bool _private, bool _readonly, TypeModel typeModel)
 {
     Name       = name;
     TypeModel  = typeModel;
     Attributes = attributes.Select(x => TypeModel.GetType(x.GetType())).ToList();
     if (_private)
     {
         Access = AccessLevel.Private;
     }
     else if (typeModel.Modifiers != null)
     {
         Access = typeModel.Modifiers.Item1;
     }
     IsReadOnly = _readonly;
 }
示例#5
0
 private IEnumerable <FieldModel> EmitParameters(IEnumerable <ParameterInfo> parms)
 {
     return(from parm in parms
            select new FieldModel(parm.GetCustomAttributes(false), parm.Name, false, false, TypeModel.GetType(parm.ParameterType)));
 }
示例#6
0
 public static IEnumerable <PropertyModel> EmitProperties(PropertyInfo[] props)
 {
     return(from prop in props
            //where prop.GetGetMethod().GetVisible() || prop.GetSetMethod().GetVisible()
            select new PropertyModel(prop, TypeModel.GetType(prop.PropertyType)));
 }