Exemplo n.º 1
0
        private object CreateAdapterInstance(IDictionary dictionary, PropertyDescriptor descriptor, Type adapterType)
        {
            var metaBindings = BindingFlags.Public | BindingFlags.Static | BindingFlags.GetField;
            var meta         = (DictionaryAdapterMeta)adapterType.InvokeMember("__meta", metaBindings, null, null, null);
            var instance     = new DictionaryAdapterInstance(dictionary, meta, descriptor, this);

            return(Activator.CreateInstance(adapterType, instance));
        }
        public DictionaryAdapterBase(DictionaryAdapterInstance instance)
        {
            This = instance;

            CanEdit     = typeof(IEditableObject).IsAssignableFrom(Meta.Type);
            CanNotify   = typeof(INotifyPropertyChanged).IsAssignableFrom(Meta.Type);
            CanValidate = typeof(IDataErrorInfo).IsAssignableFrom(Meta.Type);

            Initialize();
        }
Exemplo n.º 3
0
        public DictionaryAdapterBase(DictionaryAdapterInstance instance)
        {
            This = instance;

            CanEdit   = typeof(IEditableObject).IsAssignableFrom(Meta.Type);
            CanNotify = typeof(INotifyPropertyChanged).IsAssignableFrom(Meta.Type);
#if FEATURE_IDATAERRORINFO
            CanValidate = typeof(IDataErrorInfo).IsAssignableFrom(Meta.Type);
#else
            CanValidate = false;
#endif

            Initialize();
        }
Exemplo n.º 4
0
        public object CreateInstance(IDictionary dictionary, PropertyDescriptor descriptor)
        {
            var instance = new DictionaryAdapterInstance(dictionary, this, descriptor, Factory);

            return(creator(instance));
        }