Base solution for your next web application

Activities of "genr"

Hello,

We're looking into the new ng2 + Core template. We would like to implement Odata in the server-side portion of the template but we can't get it to work. Since the documentation is focused on the "old" template we're a little lost. Is it possible to give us some sample code how to implement it in the ng2 + Core template.

Answer

Thanks for your reply,

I need a MailKitHelper object for each tenant, so making singleton would not be a good choice.

Update: I basically solved it now by using MemoryCache

Question

For my application I created a MailService class in the Application project, the service creates a connection to a IMAP server, to get emails. In order to prevent constant reconnecting with each request, I need to save the object who is responsible for the connection in Session state. The object is not serializable and needs to be retrieved as soon as possble. Therefore I want to use Inproc session.

According to documentation the following should work:

class MailService : MyAppServiceBase, IMailService
    {
        private MailKitHelper _mailKitHelper;

        public MailService()
        {
            // try to get MailKitHelper object via inproc session state
            if (HttpContext.Current.Session != null)
                _mailKitHelper = (MailKitHelper)HttpContext.Current.Session["MailKitHelper"];

However it doesn't, the Session object is null. What's the best way to solve this problem, any help would be greatly appricated?

Showing 1 to 3 of 3 entries