Closed umar-ulabs closed 4 years ago
I'm guessing you're looking for something like this...
Triggers<Entity>.GlobalInserting.Add<IHttpContextAccessor>(e => {
var user = e.Service.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
});
Should the above code in each entity class or in SaveChanges that exposed by Data Layer?. Thanks
The code above should go wherever you want to initialize the triggers (generally you always want to do this once at start-up along with your other scaffolding).
It all depends when and where you want that trigger to be fired upon SaveChanges()
I am having hard time integration this library in my app, it has UnitOfWork and Repository pattern. I also want to pass logged in user info who performed the action from asp.net core to data layer. It seems this library can easily solve a complex issue in my app where I am logging in each controller. Thank you