Ralph Varjabedian
Coding is a systematic art

LINQ in Multi-tier Applications

Friday, April 25, 2008 1:04 PM

If you use LINQ as your database layer and you have multi layers in your design then you would know that at some point you create a set of parallel classes to LINQ entity classes that are called data transfer objects. These classes basically serve the purpose of transferring data from LINQ objects to higher levels without making the higher levels depend on LINQ generated classes, these classes are important for maintaining proper abstraction between your layers.

Transferring the data between LINQ entity objects and your data transfer objects is usually done using reflection. However using reflection is very slow so I have turned to my friend Mr. Emit.

Mr. Emit is a developer working for me at runtime and writes code for me as as needed and best of all he works for free :) His full name is System.Reflection.Emit. See how this article explains how to use System.Reflection.Emit for creating code at runtime to speed things up big time for such operations. The code in the article could be used to transfer data between any type of objects based on their Properties and not by using Reflection, but by writing code at runtime. Hope my article will speed up a lot of implementations out there.


Feedback

No comments posted yet.


Post a comment





 

Please add 7 and 3 and type the answer here: