A simple linq to SQL query Might return a product object. Obiously I could pass this object to my business layer, then read and update the data, directly against that object.
I've seen a bunch of implementations where following the execution of the linq query the resulting object is mapped (via automapper or manually) to a custom business object. So in the case of product where I might have the linq object:
product.ProductId and Product.ProductName
and then I would define a custom Product business object like so:
class BusineszProduct
{
string ProductId;
string ProductName;
}
and some simple mapping code like:
BusinessProduct myProduct = new BusinessProduct(); myProduct.ProductId = product.ProductId; myProduct.ProductName = product.ProductName;
and then pass myProduct around my business layer, modify it, read it and so on, then later update the linq object.
In what scenarios would I want to create the custom BusinessProduct class?