protected void SetValue(string propertyName, object value) { if (this.RecordState == RecordState.Deleted) { throw new InvalidOperationException(); } if (propertyName == null) { throw new ArgumentNullException(); } var fieldInfo = Resource.GetFieldInfo(typeof(TRecord), propertyName); if (fieldInfo == null) { throw new InvalidDefinitionException(); } if ((fieldInfo.IsPrimaryKeySegment || !fieldInfo.IsModifiable) && this.RecordState != RecordState.Detached) { throw new InvalidOperationException(); } fieldInfo.ConvertBack(value, this.DataBuffer); this.ChangeState(RecordStateTransitions.Modify); }
public static FieldInfo GetFieldInfo(this BinaryExpression fixedExpression, ParameterExpression argument) { FieldInfo result = null; var memberAccessExpression = fixedExpression.Left as MemberExpression; if (memberAccessExpression != null && memberAccessExpression.Expression.Equals(argument)) { result = Resource.GetFieldInfo(memberAccessExpression.Member); } return(result); }
protected object GetValue() { var method = new StackFrame(1).GetMethod(); var fieldInfo = Resource.GetFieldInfo(method); if (fieldInfo == null) { throw new InvalidDefinitionException(); } var result = fieldInfo.Convert(this.DataBuffer); return(result); }
public static FieldInfo GetField(this Expression expression, ParameterExpression argument) { var memberExpression = expression as MemberExpression; if (memberExpression != null && memberExpression.Expression.Equals(argument)) { return(Resource.GetFieldInfo(memberExpression.Member)); } else { return(null); } }
protected object GetValue(string propertyName) { if (propertyName == null) { throw new ArgumentNullException(); } var fieldInfo = Resource.GetFieldInfo(typeof(TRecord), propertyName); if (fieldInfo == null) { throw new InvalidDefinitionException(); } var result = fieldInfo.Convert(this.DataBuffer); return(result); }
protected void SetValue(object value) { if (this.RecordState == RecordState.Deleted) { throw new InvalidOperationException(); } var method = new StackFrame(1).GetMethod(); var fieldInfo = Resource.GetFieldInfo(method); if (fieldInfo == null) { throw new InvalidDefinitionException(); } if ((fieldInfo.IsPrimaryKeySegment || !fieldInfo.IsModifiable) && this.RecordState != RecordState.Detached) { throw new InvalidOperationException(); } fieldInfo.ConvertBack(value, this.DataBuffer); this.ChangeState(RecordStateTransitions.Modify); }