Using ServiceStack Ormlite global filters with Session -


i want alter example found here modifyby populated session's username every time change made. possible?

you need singleton access access username need populate in either reqeustcontext or asp.net's httpcontext.current.items dictionary, e.g:

globalrequestfilters.add((req,res,dto) => {     requestcontext.instance.items["username"] = req.getsession().userauthname; }); 

which can access inside updatefilter, e.g:

ormliteconfig.updatefilter = (dbcmd, row) => {     var auditrow = row iaudit;     var username = requestcontext.instance.items["username"] string;     if (auditrow != null)         auditrow.username = username; }; 

note: "username" work within context of http request.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

python - Error: Unresolved reference 'selenium' What is the reason? -

asp.net ajax - Jquery scroll to element just goes to top of page -