Asked by:
Global selected object

Question
-
User1697832094 posted
Hi
I want to implement a global object on my .net Core webapp with EF Core. On the frontpage you should be able to select a customer, and then
all the operation on the site should be around this customer.
Should i implement the customer object as a static object?
ThanksWednesday, September 11, 2019 3:02 PM
All replies
-
User-474980206 posted
only if this one selected customer shared for every user of the site. that is every site user is operating on the same customer.
Wednesday, September 11, 2019 4:55 PM -
User1697832094 posted
The web app going to be one database pr user. And offcourse behind login.
Would it still be shared?
How can it be done if the customer is not shared?Thursday, September 12, 2019 3:21 AM -
User1634355159 posted
I want to confirm with you, what is the effect you want to achieve, whether it is just data isolation between users, if this is the case, then you can use the Identity implementation, refer to the following link.
If you want to your user object can be achieved page-to-page delivery, you can put your user object in the session for delivery. Refer to the link below.
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-2.2
Thursday, September 12, 2019 9:12 AM -
User753101303 posted
Hi,
This is a single app used by multiple users (unlike a desktop app) so all users connected to the site see the same static value (by definition the app expose the same single variable to everyone).
I'm not 100% to get what you call a "customer" and then a "user". Do you mean you just want to know which authenticated user is running the current http request ?
It sound like you want to write a multi-tenant application ie https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy ?
Thursday, September 12, 2019 9:26 AM