public static PropertyDataInfo GetInfo <T>(T context, Expression <Func <T, object> > binding) { DataInfo dataInfo = Reflected.ObjGetDataInfo <T>(context, binding); if (dataInfo.DataInfoType == EDataInfoType.FieldInfo) { throw new Exception("Invalid property queried"); } PropertyDataInfo result = new PropertyDataInfo(); result.PropertyInfo = (PropertyInfo)dataInfo.PropertyFieldInfo; result.Context = dataInfo.Context; return(result); }
public static FieldDataInfo Register <T>(T context, string binding) { FieldDataInfo obj = new FieldDataInfo(); DataInfo dataInfo = Reflected.ObjGetDataInfo(context, binding); if (dataInfo.DataInfoType == EDataInfoType.PropertyInfo) { throw new Exception("Invalid field queried"); } FieldDataInfo result = new FieldDataInfo(); result.FieldInfo = (FieldInfo)dataInfo.PropertyFieldInfo; result.Context = dataInfo.Context; return(result); }
public static void ObjSetDataValue <T>(this T _object, Expression <Func <T, object> > expression, object value) { DataInfo dataInfo = Reflected.ObjGetDataInfo <T>(_object, expression); dataInfo.SetValue(value); }
public static object ObjGetDataValue <T>(this object _object, Expression <Func <T, object> > expression) { DataInfo dataInfo = Reflected.ObjGetDataInfo <T>(_object, expression); return(dataInfo.GetValue()); }