Returning collection from business layer

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 10-Feb-2010 05:15:36   

Hi,

In the past, if I've got a complex query that does some joins and returns fields from several tables, rather than create a view and generate an entity from it, I would just return a dynamic list.

So is it possible to have Linq to LLBLGen return a dynamic list?

I'd thought I'd be able to return from my business layer a collection of an anonymous type but (and please correct me if I'm wrong) you can only return a collection of such items from a method as a basic 'object'. (i.e. not strongly typed) so I figured I'd be better of with a good old dynamic list!

Cheers, I.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 10-Feb-2010 10:15:35   

Why don't you project the resultSet to a custom class?

Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 10-Feb-2010 18:22:15   

I could but I'd prefer not to have to define it.

Couldn't LLBLGen project it to a DataSet? A bit like this...

            IDataAccessAdapter adapter = new DataAccessAdapter();
            LinqMetaData metaData = new LinqMetaData(adapter);

            var q = from c in metaData.Author select c;

            DataTable customers = ((ILLBLGenProQuery)q).FetchTypedList();
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Feb-2010 03:09:25   

There is nothing such direct like that. Maybe this related thread would give you some options: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=17229

David Elizondo | LLBLGen Support Team