Using Reflection at runtime is bit complex and accessing object by iterating through Collection will take time .Tried to use LINQ to object to simplify this process as much as possible
In Sample here I explained 2 Scenarios of using Reflection .
1.Dynamically getting the count of Property of specific Type in an object.
2.Dynamically loading an overloaded method
Illustration in the code has both classic methods and method using LINQ
http://www.codeproject.com/KB/linq/LINQ_with_Reflection.aspx
Wednesday, September 16, 2009
Monday, September 7, 2009
Member wise Cloning in ADO.net Entityframe work
In this I will demonstrating how to create a copy of the Row with all the related child rows in Entity object .By Using this implementation you can able copy the entire entity object with mere 2 line of code without any looping .
At first, I thought of pulling the item, manually copying each property, and inserting .I found that may bit complex .Then I Binged for some idea and found of using serialization/deserialization for cloning the object .This logic basically will do deep copy of object. With this logic and some reflection and LINQ I can able to meet my requirement by creating extension method on entity objects.
Check Here for Logic and Implementation
At first, I thought of pulling the item, manually copying each property, and inserting .I found that may bit complex .Then I Binged for some idea and found of using serialization/deserialization for cloning the object .This logic basically will do deep copy of object. With this logic and some reflection and LINQ I can able to meet my requirement by creating extension method on entity objects.
Check Here for Logic and Implementation
Subscribe to:
Posts (Atom)
