Translate SQL to class

Mar 17, 2015 at 3:26 AM
I need to execute a very complex query and i need the result to be converted to a class

i am using
var directSql = _sessao.CreateFacility<IDirectDbAccessFacility>();
directSql.ExecuteDbCommand(cmd, DbExecutionType.Reader);

how can i get the result to a list of classes ?

Mar 17, 2015 at 7:22 AM
you probably mean list of Entities? no, currently there's no support for this, but definitely will be, in some future.
For now, as a workaround, you can do the following - make your complex query return only entity IDs only, read them into list, and then fire LINQ query with Where predicate like:
ent => idList.Contains(ent.Id)

this will return list of entities from IDs
Mar 17, 2015 at 12:15 PM
Not entities, like a summary entityDto.
Mar 17, 2015 at 5:15 PM
Then it is even simpler - it is plain ADO.NET code, cmd.ExecuteREader, reader.Read, etc. The way you did it before VITA