C
C
Cyril2015-08-19 09:35:13
ASP.NET
Cyril, 2015-08-19 09:35:13

Where to store temporary data in ASP.NET MVC?

Good afternoon!
I'm involved in the development of a calculation application hosted entirely on the Web. The application is engaged in the fact that, under the parameters specified by the user, it selects equipment, while maintaining all intermediate calculation values.
It looks like this: the user enters data, a window appears with a list of selected equipment. When choosing equipment, the user is shown its settings through Ajax, calculated based on the entered data.
However, a problem arises here - the Ajax request is made asynchronously, i.e. in another thread that does not see calculation objects from the first thread.
Question: where to store such data?
Right into the database? But the user needs only one equipment from the list of selected ones, so the question arises how to clear unnecessary data after the session ends. In a static ConcurrentDictionary? Cleaning is simpler, but also some kind of bad approach, it seems to me. Immediately transfer the contents of the entire calculation to the user? But there can be 5000+ elements and the page with the results starts to weigh a lot.
What are the best practices for implementing something like this? Where to dig? What to read?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Станислав Макаров, 2015-08-19
@teoadal

> Сразу в БД?
Почему нет? Только не в основную, а например в Redis (polyglot persistence)
Вы спросите нафига вам оно? Вот вам аргумент :).

Евгений Колегов, 2015-08-19
@KollegOFF

Здравствуйте!
В ASP.NET MVC есть такой объект как TempData, может он Вам подойдет?

M
make_luv, 2015-08-19
@make_luv

А Viewbag не подойдет?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question