leekelleher
10/13/2023, 3:43 PMhuwred
10/13/2023, 3:59 PMhuwred
10/13/2023, 4:06 PMcs
if (appconfig.GetConnectionString("myConnection_ProviderName") == "Microsoft.Data.Sqlite")
{
var database = new Database(appconfig.GetConnectionString("myconnection"), DatabaseType.SQLite, SqlClientFactory.Instance);
}
else
{
var database = new Database(appconfig.GetConnectionString("myconnection"), DatabaseType.SqlServer2012, SqlClientFactory.Instance);
}
leekelleher
10/14/2023, 11:11 AMleekelleher
10/14/2023, 11:35 AMSqlClientFactory
isn't available in Umbraco 11/12 (.NET 7) ... I assume it's because the "Microsoft.Data.SqlClient" library no longer ships with it. 🤔leekelleher
10/14/2023, 2:06 PMIDbProviderFactoryCreator
to make a call to _dbProviderFactoryCreator.CreateFactory(providerName)
which will give me the DbProviderFactory
, which I can pass into the new Database()
instance.huwred
10/15/2023, 5:51 AMkdx-perbol
10/16/2023, 8:21 AMleekelleher
10/16/2023, 2:30 PMleekelleher
10/16/2023, 2:37 PMvar context = new BloggingContext()
would be? e.g. is there somewhere to set what the connection string at runtime?
Reason being is the with Contentment Data List's SQL data-source, it lets the user pick a connection string, then enter a raw query.
From what my little understanding about EFCore, feels that it's designed to be more of an ORM, less cowboy raw SQL. 🤠kdx-perbol
10/16/2023, 4:05 PMBloggingContext
yourself from the Contentment database. Absolutely an ORM, so maybe not super useful as just a database query tool.Sebastiaan
10/17/2023, 7:56 AMJohn Sharp
04/09/2024, 10:41 PMJohn Sharp
04/09/2024, 10:42 PMleekelleher
04/10/2024, 12:29 PMJohn Sharp
04/10/2024, 1:21 PM