Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VS 2013 can not evaluate expression
Message
De
07/08/2014 06:29:00
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Problèmes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01605242
Message ID:
01605280
Vues:
43
This message has been marked as a message which has helped to the initial question of the thread.
>Do you know how to adjust these two calls:

Adjust in what way ?

>
> public PagedResult<Operator> GetOperators(QueryRequest queryRequest)
>        {
>            return _operatorRepository.GetPagedRequest(queryRequest);
>        }
>
>        public IEnumerable<Operator> GetAllOperators()
>        {
>            return _operatorRepository.GetAll();
>        }
>
>Do you know how to create a shorter object on the fly? The Operator object has lots of columns and I just want to return a few (in particular, OpCode, FirstName, LastName and Hidden)
>

I think you will need a concrete 'short form' of the Operator class (unless you want to mess with dynamics)
One solution: Create an implicit or explicit cast from 'Operator' to 'ShortOperator' then you should be able to tack '.Select((x => (ShortOperator) (x)))' onto the end of the GetAll(). If you don't want to implement the casting then use 'Select(x => new ShortOperator() {Name = x.Name})' etc.

One advantage of using a cast is that it can be used on single Operator instances as well..
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform