>>>Do you know how to adjust these two calls:
>>
>>Adjust in what way ?
>>
>>>
>>> public PagedResult<Operator> GetOperators(QueryRequest queryRequest)
>>> {
>>> return _operatorRepository.GetPagedRequest(queryRequest);
>>> }
>>>
>>>
>>>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)
>>>
>>>>> public IEnumerable<Operator> GetAllOperators()
>>> {
>>> return _operatorRepository.GetAll();
>>> }
>>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.
Without knowing more detail on the layers it's hard to say. But I'd be inclined to leave the base class alone. If you do that you could simply add an additional method to the child class. So given an implicit cast to 'ShortOperator' you could just add a method:
public IEnumerable<ShortOperator> GetAllShortOperators()
{
return _operatorRepository.GetAll().Select((x => (ShortOperator)(x)));
}