RepositoryBase has this code
public virtual T GetById(object id)
{
return _dbSet.Find(id);
}
Do you know how to adjust these two calls:
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)
>Not much to go on here. What's in base.GetById() ?
>
>
>>I am trying to debug a code from repository:
>>
>>
>>public override Operator GetById(object id)
>> {
>> var result = base.GetById(id);
>> if (result == null)
>> return result;
>> HashOpCode(result);
>> return result;
>> }
>>
>>Unfortunately, in the locals window I see 'Could not evaluate expression' and same when I try to access properties of result in the immediate window.
>>
>>Is there a way to see the actual properties values? Why would I get this error? Could it be due to the var declaration?
>>
>>Thanks in advance.
>>
>>I also have another question - we're passing a string of OpCode as object and using base.GetById(id) method. In SQL Server profiler I'm seeing the following code
>>
>>
>>SELECT TOP (2)
>> [Extent1].[op_code] AS [op_code],
>>...
>>where op_code = @p0'
>>
>>and @p0 is set to be varchar(8000) while the actual column is char(6). How can we make Entity Framework to use the actual type and length and why does it say select top (2)?
>>
>>Thanks in advance.
If it's not broken, fix it until it is.
My Blog