Пример #1
0
        public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor) :
            base(type)
        {
            if (typeDescriptor == null)
                typeDescriptor = new CustomTypeDescriptor(type);
            
            int count = 0;
            PropertyDescriptorCollection properties = typeDescriptor.GetProperties();
            IObjectMemberImporter[] importers = new IObjectMemberImporter[properties.Count];
            
            for (int i = 0; i < properties.Count; i++)
            {
                IServiceProvider sp = properties[i] as IServiceProvider;
                
                if (sp == null)
                    continue;
                
                IObjectMemberImporter importer = (IObjectMemberImporter) sp.GetService(typeof(IObjectMemberImporter));
                
                if (importer == null)
                    continue;
                
                importers[i++] = importer;
                count++;
            }

            _properties = properties;

            if (count > 0)
                _importers = importers;
        }
 public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor) :
     base(type)
 {
     if (typeDescriptor == null)
         typeDescriptor = new CustomTypeDescriptor(type);
     
     _properties = typeDescriptor.GetProperties();
 }
Пример #3
0
        public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor) :
            base(type)
        {
            if (typeDescriptor == null)
            {
                typeDescriptor = new CustomTypeDescriptor(type);
            }

            _properties = typeDescriptor.GetProperties();
        }
Пример #4
0
        public ComponentImporter(Type type, ICustomTypeDescriptor typeDescriptor, IObjectConstructor constructor) :
            base(type)
        {
            if (typeDescriptor == null)
            {
                typeDescriptor = new CustomTypeDescriptor(type);
            }

            int count = 0;
            PropertyDescriptorCollection properties = typeDescriptor.GetProperties();

            IObjectMemberImporter[] importers = new IObjectMemberImporter[properties.Count];

            for (int i = 0; i < properties.Count; i++)
            {
                IServiceProvider sp = properties[i] as IServiceProvider;

                if (sp == null)
                {
                    continue;
                }

                IObjectMemberImporter importer = (IObjectMemberImporter)sp.GetService(typeof(IObjectMemberImporter));

                if (importer == null)
                {
                    continue;
                }

                importers[i] = importer;
                count++;
            }

            _properties = properties;

            if (count > 0)
            {
                _importers = importers;
            }

            _constructor = constructor;
        }