cerberis wrote:
Basically trying to solve this:
An unhandled exception occurred while processing the request.
ORMGeneralOperationException: None of the factories in the list of "Devart.Data.MySql, CoreLab.MySql" were found.
Please check machine.config and the .NET version your application is running on.
TypeInitializationException: The type initializer for SD.LLBLGen.Pro.DQE.MySql.DynamicQueryEngine threw an exception.
And no, I cannot modify machine.config.
But surely you've installed the mysqlconnect provider with the installer?
ASP.NET Core is nothing else just console application listening on specified port and accepting requests. So there is no difference is it ASP.NET Core or .NET Core app..
.NET core is a platform, it's a .NET flavor. ASP.NET is a web framework, completely different. ASP.NET core isn't the same as .net core at all, it's comparing apples with trucks.
ASP.NET core doesn't use a web.config file, so I think that's part of the problem? Didn't any of the solutions here help you? https://docs.asp.net/en/latest/fundamentals/configuration.html
And static methods are antipattern because it is hard to test, it is hard to override, reusing such code results in hard coupling of the code.
Who told you that bullshit? Some methods aren't extension points so aren't overridable, whether they're static or not. That you don't like that is too bad, but it's not up to you to decide what is an extension point. Hard to test, by whom? I can test them without problems. Static methods are part of OO programming. What's wrong with a function?
In your case you are allowing to override class in one place, but still using static method of your class for some methods.
Yes, because you are arguing that a random point in the code should be an extension point for you while it's not. The code you refer to is a static constructor. It runs once, and for a reason, it does things which are potentially slow. It is done this way so threading issues aren't a problem and locks aren't needed. Yes, this isn't extensible, but static constructors aren't a spot for extensibility anyway (nor are normal constructors).
My code isn't bad, it's not meant to extensible in a way you want it to, simply because elsewhere things go wrong, namely asp.net core doesn't offer a way to specify the DbProviderFactory, and then my code is inflexible and not extensible?
Have you asked the ASP.NET team how to solve this? It's .NET full after all, not .net core, and it offers a way to define DbProviderFactory definitions.
It's actually a problem of ASPNET core not being able to use resources properly on .NET full. Or better, to register a custom factory. See this issue: https://github.com/dotnet/corefx/issues/6476. There's an api underway which solves this, however it's not yet available (will be after .NET full v4.6.2) where you can register the factory in code. That would solve things properly. I could add a method which registers a factory in some static (yes! because some things are stored only once) structure but that's actually moot as it will be obsolete forever once MS does their job for once and implements code which actually works and adds that api I referred to above.