using System.Reflection; using Oracle.EntityFrameworkCore.Infrastructure; // ReSharper disable once CheckNamespace namespace Elsa.EntityFrameworkCore.Extensions; /// /// Provides extensions to configure EF Core to use Oracle. /// public static class OracleProvidersExtensions { private static Assembly Assembly => typeof(OracleProvidersExtensions).Assembly; public static TFeature UseMySql(this PersistenceFeatureBase feature, string connectionString, ElsaDbContextOptions? options = null, Action? configure = null) where TDbContext : ElsaDbContextBase where TFeature : PersistenceFeatureBase { return feature.UseMySql(Assembly, connectionString, options, configure); } public static TFeature UseMySql(this PersistenceFeatureBase feature, Func connectionStringFunc, ElsaDbContextOptions? options = null, Action? configure = null ) where TDbContext : ElsaDbContextBase where TFeature : PersistenceFeatureBase { return feature.UseMySql(Assembly, connectionStringFunc, options, configure); } public static TFeature UseMySql(this PersistenceFeatureBase feature, Assembly migrationsAssembly, string connectionString, ElsaDbContextOptions? options = null, Action? configure = null ) where TDbContext : ElsaDbContextBase where TFeature : PersistenceFeatureBase { return feature.UseMySql(migrationsAssembly, _ => connectionString, options, configure); } public static TFeature UseMySql(this PersistenceFeatureBase feature, Assembly migrationsAssembly, Func connectionStringFunc, ElsaDbContextOptions? options = null, Action? configure = null ) where TDbContext : ElsaDbContextBase where TFeature : PersistenceFeatureBase { feature.DbContextOptionsBuilder = (sp, db) => db.UseElsaOracle(migrationsAssembly, connectionStringFunc(sp), options, configure: configure); return (TFeature)feature; } }