Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'System.Data.Entity.DbSet' does not contain a definition for
Message
De
27/06/2014 10:15:31
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Titre:
'System.Data.Entity.DbSet' does not contain a definition for
Versions des environnements
Environment:
C# 4.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01602673
Message ID:
01602673
Vues:
72
Hi,

I am working on an ASP.NET MVC app using Web API.

I am trying to create the ability to pull back a subset of data to display on a page.

So I have my repository defined like this:
using IBCPackTrack.Models;
using System;
using System.Data.Entity;
using System.Linq;

namespace IBCPackTrack.Data
{
    public class DeliveryHistoryRepository : GenericRepository<DeliveryHistory>
    {
        public DeliveryHistoryRepository(DbContext context)
            : base(context)
        {

        }

        public IQueryable<DeliveryHistory> GetByRouteId(Guid id)
        {
            return DbSet.Select(dh => new DeliveryHistory
            {
                del_pk = dh.del_pk,
                del_time = dh.del_time,
            });

        }
    }
}
This is giving me a syntax error under the Select in "DbSet.Select":

'System.Data.Entity.DbSet' does not contain a definition for 'Select'

I'm not sure why as this code works fine in another application that I am using as an example.

Basically what I want to do is accept a key and use that key to produce a subset of data from DeliveryHistory like this SQL would produce:

SELECT DeliveryHistory.*
FROM DeliveryHistory
INNER JOIN RunSheetDetails on del_rndfk = rnd_pk
INNER JOIN RunsheetHeaders on rnd_rnhfk = rnh_pk
WHERE rnh_rtefk = @RouteId

Any help appreciated!
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform