I want to get records from the database using EF and assign the values to a DTO class.Consider the following tables for a Linq query.
TableA,TableB, TableC
F
I would make a factory method, ie: TableA_DTO CreateDTO(TableAItem item);
Using this, you could just rewrite your query as:
IEnumerable = TableA.AsEnumerable().Select(CreateDTO);
This would give you the collection of "DTO" objects directly.
That being said, if you're using Entity Framework, the EF Code First added in recent versions might be more useful in this case.