Code
This method works well in the case of changes to the LINQ clause.
(Lgd_inn) toolbox. propertycopy (objinn, R );
/// <Summary>
/// Attribute assignment between two instances
/// </Summary>
/// <Param name = "obj1"> </param>
/// <Param name = "obj2"> </param>
/// <Returns> </returns>
Public static object propertycopy (Object objsrc, object objdest)
{
Type soutype = objsrc. GetType ();
Type tartype = objdest. GetType ();
Propertyinfo [] Pis = soutype. getproperties (bindingflags. Public | bindingflags. instance );
If (null! = PIS)
{
Foreach (propertyinfo PI in PIS)
{
String propertyname = pi. Name;
Propertyinfo Pit = tartype. getproperty (propertyname );
If (pit! = NULL)
{
Pit. setvalue (objdest, Pi. getvalue (objsrc, null), null );
}
}
}
Return objdest;
}
This method is useful when you modify a value in LINQ because a value is obtained first and then modified. This method is not required.
When bound to the sqldatasource control, you can achieve better performance by setting the datasourcemode attribute to datareader.