PomeloFoundation / Caching-MySQL

MIT License
20 stars 10 forks source link

Auto detect database field from ConnectionString to be used as schema name if it exists #111

Closed Voileexperiments closed 6 months ago

Voileexperiments commented 6 months ago

Currently MySqlCacheOptions requires SchemaName to be provided to work, which seems like it is designed for generic SQL implementations rather than specific to MySQL.

It makes sense for a generic SQL implementation to require a SchemaName field as database and schema are different; however in MySQL database is synonymous with schema (and is the only major SQL engine that does this IIRC), which can be specified in the connection string with the Database field. If I have provided a Database field in my connection string, I'm already connected to a specific database; further asking me to provide a SchemaName would be a unnecessary separation/duplication of data.

This is particularly strange as Pomelo.EntityFrameworkCore.MySql only uses a single connection string with Database field filled in. So by using both libraries I'm forced to handle connection strings in two different ways.

I believe DbConnectionStringBuilder can be used for this purpose.

ChaosEngine commented 6 months ago

Branch for this is no-schemaName, will be testing there