>>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..
I was thinking along the same lines. So, do I always need to change the signature of that method to be
public PagedResult<OperatorList>
instead of current implementation?
Will I also have to change the repository interface as well?
Our application is quite complex and I am a bit confused as where should I made the change exactly.
If it's not broken, fix it until it is.
My Blog