Select form an entity with Queryspec

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 15-Mar-2015 20:48:36   

Here is my query so far. I'm getting exceptions about missing columns and a lack of projections.

            var qf = new QueryFactory();

            var query = qf.Create()
                .From(qf.VwWeekenderChaletAllocationOrder
                    .Where(VwWeekenderChaletAllocationOrderFields.EventId == eventId)
                    .AndWhere(VwWeekenderChaletAllocationOrderFields.ForSale == true)
                    .AndWhere(VwWeekenderChaletAllocationOrderFields.Berth == berth)
                    .AndWhere(VwWeekenderChaletAllocationOrderFields.ChaletInstanceId != assignedParkChaletIds.ToArray()))
                .Where(VwWeekenderChaletAllocationOrderFields.FloorBlockCount == quantity)
                .OrderBy(VwWeekenderChaletAllocationOrderFields.ChaletClassId.Ascending(),
                    VwWeekenderChaletAllocationOrderFields.Block.Ascending(),
                    VwWeekenderChaletAllocationOrderFields.Floor.Descending(),
                    VwWeekenderChaletAllocationOrderFields.ParkChaletId.Ascending())
                .Limit(quantity)
                .WithProjector(r => new VwWeekenderChaletAllocationOrderEntity
                {
                });

            var collection = new DataAccessAdapter().FetchQuery(query);

The gist of it is that I have an entity that I need to filter and then I need to filter the result and order it and end up with a list of the original entity.

How can I do this? sunglasses

Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 15-Mar-2015 22:10:51   

I can't put all the where clauses on the inner query because the FloorBlockCount field is the result of an OVER clause.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Mar-2015 08:05:25   

Ian wrote:

I can't put all the where clauses on the inner query because the FloorBlockCount field is the result of an OVER clause.

How did you do that? Please show the code of that.

David Elizondo | LLBLGen Support Team