c# - Ninject Scope and System.Threading.Timer -
How can the timer open a new ninja reference on the task? Configuring the nineteenth area of a network of hard times if I set it as InRequestScope () does not work on non-requested tasks. That's why I'm setting the following so that I can get InThreadScope for work:
kernel.Bind But like this, when I set a timer
< Code> timer timer = new timer (_ = & gt; delayed disconnect (chatUser.User.AuthorizationId), tap, timespace.fomseconds (10), timespace from milliseconds (-1)); dbContext does not refresh with new database values.
Public Deletion Declined Disconnect {String Authentication ID} {var myChatUser = GetChatUserByClaimedIdent Ifier (authorizationId); if (! MyChatUser.ChatClients.Any ()) / / old state (does not reflect the database change from 10 seconds ago). Then ... current How to open a new blank "context" to reflect state / db values?
Background tasks should not be run in the ASP.NET application. To do this, write a service
Using a window service, It's easy to set up a timer that requests some processor that works from the kernel, now you can use the nemescope extension and define that the processor has some objects such as eod Kernel.bund & lt; SomeProcessor & gt; () Is the scope for. ToSelf () DefinesNamedScope ("Processor"); Kernel.Bind & LT; IUoW>. () & Lt; UOW & gt; () InNamedScope ("Processor");
Comments
Post a Comment