/// <summary>
        /// Gets the set accessor for this <see cref="InterfaceImplementationPropertyInformation"/>. If the interface declaring this
        /// <see cref="InterfaceImplementationPropertyInformation"/> also declares the accessor, an <see cref="InterfaceImplementationMethodInformation"/>
        /// for that accessor is returned. Otherwise, the <see cref="IMethodInformation"/> (if any) on the type implementing the interface is returned.
        /// </summary>
        /// <param name="nonPublic">Indicates whether a non-public accessor method may also be returned. If the interface declares the accessor,
        /// this flag has no effect since interface methods are always public. If only the implementation type declares the accessor, the flag is used to
        /// determine whether to return that accessor.</param>
        /// <returns>
        /// An instance of <see cref="InterfaceImplementationMethodInformation"/> for the set method if the accessor is delared by the interface.
        /// Otherwise, an instance of <see cref="IMethodInformation"/> for the set method on the implementation type, or <see langword="null" /> if
        /// there is no such method or its visibility does not match the <paramref name="nonPublic"/> flag.
        /// </returns>
        public IMethodInformation GetSetMethod(bool nonPublic)
        {
            var interfaceAccessor = _declarationPropertyInfo.GetSetMethod(nonPublic);

            if (interfaceAccessor != null)
            {
                return(new InterfaceImplementationMethodInformation(_implementationPropertyInfo.GetSetMethod(true), interfaceAccessor));
            }
            else
            {
                return(_implementationPropertyInfo.GetSetMethod(nonPublic));
            }
        }
        private void PropertyChanging(ClientTransaction clientTransaction, DomainObject domainObject, IPropertyInformation propertyInfo)
        {
            if (SecurityFreeSection.IsActive)
            {
                return;
            }

            var securableObject = domainObject as ISecurableObject;

            if (securableObject == null)
            {
                return;
            }

            var securityClient    = GetSecurityClient();
            var methodInformation = propertyInfo.GetSetMethod(true) ?? s_nullMethodInformation;

            using (EnterScopeOnDemand(clientTransaction))
            {
                securityClient.CheckPropertyWriteAccess(securableObject, methodInformation);
            }
        }
        protected PropertyBase(Parameters parameters)
        {
            ArgumentUtility.CheckNotNull("parameters", parameters);

            if (parameters.PropertyInfo.GetIndexParameters().Length > 0)
            {
                throw new InvalidOperationException("Indexed properties are not supported.");
            }

            _businessObjectProvider = parameters.BusinessObjectProvider;
            _propertyInfo           = parameters.PropertyInfo;
            _underlyingType         = parameters.UnderlyingType;
            _listInfo             = parameters.ListInfo;
            _isRequired           = parameters.IsRequired;
            _isReadOnly           = parameters.IsReadOnly;
            _defaultValueStrategy = parameters.DefaultValueStrategy;
            _bindablePropertyReadAccessStrategy  = parameters.BindablePropertyReadAccessStrategy;
            _bindablePropertyWriteAccessStrategy = parameters.BindablePropertyWriteAccessStrategy;
            _bindableObjectGlobalizationService  = parameters.BindableObjectGlobalizationService;
            _isNullable  = GetNullability();
            _valueGetter = Maybe.ForValue(_propertyInfo.GetGetMethod(true)).Select(mi => mi.GetFastInvoker <Func <object, object> >()).ValueOrDefault();
            _valueSetter = Maybe.ForValue(_propertyInfo.GetSetMethod(true)).Select(mi => mi.GetFastInvoker <Action <object, object> >()).ValueOrDefault();
        }