I have DataContext classes generated from dbml. Once I get data from the database, I need to transform them into DataContract classes so that the objects can be sent via WCF.
One way to do this is like this:
using (var dc = new TestDBL2SDataContext(Settings.Default.TestDBConnectionString))
{
var myEmp = from rec in dc.Employees
select new MyDataContracts.Employee
{
FirstName = rec.Name.Substring(0,10)
};
return myEmp.FirstOrDefault();;
}
Is there a better way to do this via an XSD/XSLT file that I can define in my project and simply point to ?