Beispiel #1
0
        internal void CreateMappings()
        {
            var bindableProperties = GetBindableProperties();
            var publicGetters      = bindableProperties.Where(p => p.CanRead && p.GetGetMethod() != null && p.GetGetMethod().IsPublic).ToArray();

            _getters = new Dictionary <string, PropertyAccessor <Func <object> > >();

            foreach (var getterProp in publicGetters)
            {
                _getters.Add(getterProp.Name, PropertyBinder.CreateGetter(getterProp, this));
            }

            var publicSetters = bindableProperties.Where(p => p.CanWrite && p.GetSetMethod() != null && p.GetSetMethod().IsPublic).ToArray();

            _setters = new Dictionary <string, PropertyAccessor <Action <object> > >();

            foreach (var setterProp in publicSetters)
            {
                _setters.Add(setterProp.Name, PropertyBinder.CreateSetter(setterProp, this));
            }
        }