Hi,
when I am logging MvcController's actions it gets logged twice. One record for real controller and second for proxy created by castle dynamic proxy.
Single request for Home/Index results in two records in Audit log
Is there a way remove proxies from logging? I am unable to change this behaviour by using Auditing Selectors.
Any suggestions? Thanks
Hi,
It looks like Microsoft.Bcl.Immutable package has been removed from nuget gallery. Do you have a plan to use System.Collections.Immutable package instead?
Radek
Hi,
I want to implement support for querying data using OData protocol v4. I have working example with fake data. Now I am trying to read data from database, but I don't see how I could possibly use combination of repository's IQueryable<T> GetAll() and UnitOfWork attribute.
I would like to have ODataController to look like this :
public class UsersController : ODataController
{
private readonly IUserRepository _userRepo;
public UsersController(IUserRepository userRepo)
{
_userRepo = userRepo;
}
[EnableQuery]
[UnitOfWork] // this will not work
public IQueryable<User> Get()
{
return _userRepo.GetAll(); // this is the problem - DbContext will be disposed before it is needed.
}
}
I was able to get things done by using folowing alternative code:
[EnableQuery]
public IEnumerable<User> Get(ODataQueryOptions<User> query)
{
return _userRepo.Query( q => query.ApplyTo(q).Cast<User>().ToList());
}
But former solution is much better and cleaner only if it would work. Is there any possibility to keep DbContext alive to the point when Controller itself is disposed? E.g. something like UnitOfWork placed on entire controller not only its action?
Thanks of any suggestions.