示例#1
0
        public AssemblyDataType(Type type)
        {
            Name = type.Name;
            accessModificator = DataAccessModificator.GetTypeModifiers(type);
            typeAttribute     = DataAttribute.GetTypeAtributes(type);
            typeClass         = DataTypeClass.GetTypeClass(type);
            this.type         = type;

            Fields      = new List <AssemblyTypeMember>();
            IsGenerated = IsCompilerGenerated(type);

            var flags = BindingFlags.Instance |
                        BindingFlags.Static |
                        BindingFlags.NonPublic |
                        BindingFlags.Public |
                        BindingFlags.DeclaredOnly;

            foreach (var fieldInfo in type.GetFields(flags))
            {
                Fields.Add(new AssemblyTypeMember(fieldInfo, IsCompilerGenerated(fieldInfo)));
            }

            foreach (var properyInfo in type.GetProperties(flags))
            {
                Fields.Add(new AssemblyTypeMember(properyInfo, IsCompilerGenerated(properyInfo)));
            }

            foreach (var methodInfo in type.GetMethods(flags))
            {
                if (!methodInfo.IsDefined(typeof(ExtensionAttribute), false))
                {
                    Fields.Add(new AssemblyTypeMember(methodInfo, IsCompilerGenerated(methodInfo)));
                }
            }
        }
示例#2
0
        public AssemblyDataType(Type extendedType, MethodInfo[] extensionMethods)
        {
            Name = extendedType.Name;
            accessModificator = DataAccessModificator.GetTypeModifiers(extendedType);
            typeAttribute     = DataAttribute.GetTypeAtributes(extendedType);
            typeClass         = DataTypeClass.GetTypeClass(extendedType);
            this.type         = extendedType;

            Fields = new List <AssemblyTypeMember>();
            foreach (var methodInfo in extensionMethods)
            {
                Fields.Add(new AssemblyTypeMember(methodInfo, IsCompilerGenerated(methodInfo), true));
            }
        }