Пример #1
0
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <returns>EntityValue.</returns>
        /// <remarks>
        ///     <para>创建:Teddy</para>
        ///     <para>日期:2016-10-17</para>
        /// </remarks>
        internal EntityValue GetValue(string propertyName)
        {
            var key = this.GetType().FullName + "_" + propertyName;
            DynamicMethodProxyHandler handler;

            if (cache.ContainsKey(key))
            {
                handler = cache[key];
            }
            else
            {
                lock (cacheLocker)
                {
                    if (cache.ContainsKey(key))
                    {
                        handler = cache[key];
                    }
                    else
                    {
                        var property = this.GetType().GetProperty(propertyName);

                        handler = dymFac.GetPropertyGetMethodDelegate(property);
                        cache.Add(key, handler);
                    }
                }
            }
            var entityValue = new EntityValue();
            var column      = this.Schema.GetColumn(this.GetTableName() + "." + propertyName);

            entityValue.Column = column;
            entityValue.Value  = handler(this, null);
            return(entityValue);
        }