right way to have role based custom auth query database on every request asp.net mvc

前端 未结 2 1761
别跟我提以往
别跟我提以往 2021-01-14 07:24

This may be a slightly ignorant question but Im new to mvc so Im sorry!

I studied the nerd dinner auth model but In my app I have a complicated role based authentica

2条回答
  •  天涯浪人
    2021-01-14 08:02

    "Correct?" Its a matter of opinion.

    I'd say, if you aren't experiencing issues with the database performance caused by this query, then don't worry about it.

    If you are, you can centralize your authentication code into some sort of auth provider or type, and cache authentication information in memory until a write updates the database, which should invalidate the cache at the same time.

    (Your second question would do well on its own; I don't have enough info to answer it.)

提交回复
热议问题