Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you can implement both this satistic. Its difficult to say without understanding business logic you need. But if you need more detailed information about every request (visited user roles, retrive controller/action name for some specific statistic, log access to specific resources etc.) you can easily implement this by using action filter.</p> <pre><code>public class StatisticFilter : ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { base.OnActionExecuted(filterContext); if (filterContext.IsChildAction) //if action call was from view like @Html.Action do nothing return; var CurrentUser = filterContext.RequestContext.HttpContext.User; if (CurrentUser.IsInRole("some_role")) return; //write logic for this role string controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; string actionNaem = filterContext.ActionDescriptor.ActionName; //here the id of the accessed resource - document, sale, page etc. string id = filterContext.RequestContext.RouteData.Values["id"].ToString(); } } </code></pre> <p>Thats all. You can extend this by any logic you need. In my project i have the statistic table with filds: Date - timestamp,</p> <p>Controller - string,</p> <p>Action - string,</p> <p>id - bigint</p> <p>method - string(POST, GET... if post - submited)</p> <p>user_id - bigint</p> <p>And insert record for every request executed. So i have most important information about request for any statistic.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload