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 -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -