Accessing HttpContext and User Identity from data layer

前端 未结 6 1955
Happy的楠姐
Happy的楠姐 2021-02-15 11:08

I need to implement AddedBy/ChangedBy type fields on my Base Entity that all other entities inherit from ( Fluent Nhibernate ).

Accessing HttpContext.User.Identity

6条回答
  •  孤城傲影
    2021-02-15 11:36

    The AddedBy/ChangedBy field is potentially important in any data backend. You may even want to have AccessedBy for logging purposes. Therefore, you would want to think that the user information is a central part of your data. It is also possible that you may want other details such as the client's IP address logged for security reasons. Probably a good idea to have the entire context rippled down to the data layer so that you have the flexibility to capture and save the client information.

提交回复
热议问题