Last post Apr 16, 2020 07:44 AM by mywatermelon
Apr 15, 2020 12:55 PM|mywatermelon|LINK
The database will record the batch number/name/production date(accurate to minutes) of the food. After the user bought the food, he will visit the website via QRCODE on the package(every QRCODE on the package is different) to get to know its batch number/name/produce
Now I need to design the database with MYSQL.
In my opinion, the QRCODE on the package not only contains a primary key but also a production month.
The data will store into different databases by the production month and select by the primary key. I did this for I want to select the data faster.
So when there is a new month, I have to create a brand new database and the entity framework needs to select data from it also.
I don't want to change the code of the project every month for this. Is there a way for me to load a dynamic database by entity framework core?
Or maybe there is a better way to solve this problem? Thank you.
Apr 15, 2020 01:09 PM|PatriceSc|LINK
So it seems you want to compute a connection string so that you can use the database you want.
You could also have a single database and move data to a history table or use https://www.vertabelo.com/blog/everything-you-need-to-know-about-mysql-partitions/
How many rows do you have each months? It is kept for how long. is this ok to have 120 databases in 10 years from now ?
Apr 15, 2020 02:25 PM|mywatermelon|LINK
There will be about 100,000 data add to the database pre-day so I have to think about this.
It looks good for me.
Let me learn and try first.
Apr 16, 2020 07:37 AM|samwu|LINK
Is there a way for me to load a dynamic database by entity framework core?
You can refer to below link about how to dynamically create database.
You can refer to below link about how to dynamically change connection string in Asp.Net Core.
Apr 16, 2020 07:44 AM|mywatermelon|LINK
Although @PatriceSc 's way looks best on me while your way is best to the topic. Thank you.