Last post Jul 22, 2019 08:26 AM by PatriceSc
Jul 20, 2019 11:15 PM|afrika|LINK
in my previous projects, I had used inherited controllers to persist data across my last project e.g.
public class UsersController : ProjectAController
Although I added custom data to the base controller, e.g. shopping cart, alerts, statistics etc
These values are values that are loaded in the _Layout page (and are loaded once from the database, instead of repetitive round trip coding
What is best practices ?
Jul 22, 2019 07:43 AM|Rena Ni|LINK
I suggest that you could share the same database with the two projects.
Take a shopping cart as an example, in ProjectA controller,each time you add/delete a product, you could store/delete a record into your database.Then you could get the product list from the same database in the ProjectB.CartController.
Jul 22, 2019 08:26 AM|PatriceSc|LINK
The best practice is to use what best fit your need rather than to apply blindly some kind of general recipe. See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-2.2 and
then it depends on which freshness/location/lifetime you need.
For example first do you want the user to see the same information on its next sesssion ? Then you should anwyay store this in a db (which doesn't prevent to use caching or whatever).