示例#1
0
        public object GetValue(object userObject) // wrapp it in cacheentry
        {
            Debug.Assert(null != _clrProperty, "shadowstate not supported");
            object dataObject = LightweightCodeGenerator.GetValue(_clrProperty, userObject);

            return(dataObject);
        }
        public override object GetValue(object item)
        {
            EntityUtil.CheckArgumentNull(item, "item");

            if (!_itemType.IsAssignableFrom(item.GetType()))
            {
                throw EntityUtil.IncompatibleArgument();
            }

            object propertyValue;

            DbDataRecord dbDataRecord = item as DbDataRecord;

            if (dbDataRecord != null)
            {
                propertyValue = (dbDataRecord.GetValue(dbDataRecord.GetOrdinal(_property.Name)));
            }
            else
            {
                propertyValue = LightweightCodeGenerator.GetValue(_property, item);
            }

            return(propertyValue);
        }