Base solution for your next web application
Open Closed

How Set datafilter value from session? #1460


User avatar
0
omital created

Hi, first of all I create new NameValue in claims that initial in login method, after that I declare a data filter that called "bookId". for now I set "bookId" manually in each application service's methods for example:

CurrentUnitOfWork.SetFilterParameter("BookFilter", "bookId", _sessionAppService.CurrentBookId());

How can set bookId in entire project like tenantId data filter?


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Override Initialize method in your dbcontext and set it like we do: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.EntityFramework/EntityFramework/AbpDbContext.cs#L165">https://github.com/aspnetboilerplate/as ... xt.cs#L165</a> (remember to call base.Initialize first.)

  • User Avatar
    0
    omital created

    Awesome framework based on .net. ;) :)