예제 #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);
        }
예제 #2
0
 public void SetValue(object userObject, object value) // if record , unwrapp to object, use materializer in cacheentry
 {
     Debug.Assert(null != _clrProperty, "shadowstate not supported");
     if (DBNull.Value == value)
     {
         value = null;
     }
     if (IsComplex && value == null)
     {
         throw EntityUtil.NullableComplexTypesNotSupported(CLayerName);
     }
     LightweightCodeGenerator.SetValue(_clrProperty, userObject, value);
 }
 public override void SetValue(object item, object value)
 {
     EntityUtil.CheckArgumentNull(item, "item");
     if (!_itemType.IsAssignableFrom(item.GetType()))
     {
         throw EntityUtil.IncompatibleArgument();
     }
     if (!_isReadOnly)
     {
         LightweightCodeGenerator.SetValue(_property, item, value);
     } // if not entity it must be readonly
     else
     {
         throw EntityUtil.WriteOperationNotAllowedOnReadOnlyBindingList();
     }
 }
        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);
        }