How to save user credentials on a server to execute queries in the background

Background:

We have an ASP.NET/Silveright web application. The silverlight client displays the user specific data in graphical form - he requests data from the server:

enter image description here

Problem: Getting this data is expensive due to the basic database queries that the server must execute, so the client must wait ...

Optimization idea: We regularly run queries on the database on the server, writing the results to the userdata table in the "close" database, where the ASP.NET server is running.

The process of starting queries and writing data to tables by the data collection service, which is separate from the ASP.NET server.

enter image description here

, 'userdata'. - , , userdata , ASP.NET. , , .

, , , .

, : ( ).

:

"" ? , " " . .

+2
1

, , . UserData.

, -, , .

class MyClass
{
    public static void DoSomething(object principal)
    {
        if (principal == null || !(principal is IPrincipal))
            throw new ArgumentException();
        Thread.CurrentPrincipal = (IPrincipal) principal;
        // Do heavy querying and update UserData
    }
}

ASP.NET MVC- :

public ActionResult Index() 
{
    var t = new Thread(MyClass.DoSomething);
    t.Start(User);

    return View();
}

UserData . , .

, , CQRS, , IPrincipal, /, . , IPrincipal , .

, . .

+1

Source: https://habr.com/ru/post/1790005/


All Articles