/// <summary>
        /// Initializes the property implementer for the given property.
        /// </summary>
        /// <param name="propertyInfo">PropertyInfo of the property to implement.</param>
        internal ProxyPropertyImplementer(ProxyPropertyInfo propertyInfo)
        {
            if (null == propertyInfo)
            {
                throw new ArgumentNullException(nameof(propertyInfo));
            }

            this._propertyInfo = propertyInfo;
        }
예제 #2
0
        /// <summary>
        /// Adds a proxy property descriptor for a property to be implemented on the type when it is generated.
        /// </summary>
        /// <param name="propertyInfo">Descriptor of the property to add.</param>
        internal void AddPropertyInfo(ProxyPropertyInfo propertyInfo)
        {
            if (this._properties.ContainsKey(propertyInfo.PropertyName))
            {
                this._properties.Remove(propertyInfo.PropertyName);
            }

            var implementer = new ProxyPropertyImplementer(propertyInfo);

            this._properties.Add(propertyInfo.PropertyName, implementer);
        }
예제 #3
0
        /// <summary>
        /// Gets a proxy property implementer for a property that does not have any special requirements for the proxy.
        /// </summary>
        /// <param name="propertyInfo">PropertyInfo of the property to implement.</param>
        /// <returns>Proxy property implementer for the property that does not have any special requirements for the proxy.</returns>
        private ProxyPropertyImplementer GetDefaultProxyPropertyImplementer(PropertyInfo propertyInfo)
        {
            var proxyPropertyInfo = new ProxyPropertyInfo
            {
                PropertyName                = propertyInfo.Name,
                BasePropertyInfo            = propertyInfo,
                ProxyPropertyType           = propertyInfo.PropertyType,
                Attributes                  = propertyInfo.GetCustomAttributes(true).OfType <Attribute>().ToArray(),
                ExcludeFromProxy            = false,
                ConversionToProxyDelegate   = null,
                ConversionFromProxyDelegate = null
            };
            var implementer = new ProxyPropertyImplementer(proxyPropertyInfo);

            return(implementer);
        }