| | | 1 | | using System.Reflection; |
| | | 2 | | using Microsoft.EntityFrameworkCore; |
| | | 3 | | using Microsoft.EntityFrameworkCore.Infrastructure; |
| | | 4 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Persistence.EFCore; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Provides options for configuring Elsa's Entity Framework Core integration. |
| | | 10 | | /// </summary> |
| | | 11 | | public static class ElsaDbContextOptionsExtensions |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Installs a custom extension for Elsa's Entity Framework Core integration. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="optionsBuilder">The options builder to install the extension on.</param> |
| | | 17 | | /// <param name="options">The options to install.</param> |
| | | 18 | | public static DbContextOptionsBuilder UseElsaDbContextOptions(this DbContextOptionsBuilder optionsBuilder, ElsaDbCon |
| | | 19 | | { |
| | 1653 | 20 | | ((IDbContextOptionsBuilderInfrastructure)optionsBuilder).AddOrUpdateExtension(new ElsaDbContextOptionsExtension( |
| | 1653 | 21 | | optionsBuilder.ReplaceService<IMigrationsAssembly, DbSchemaAwareMigrationAssembly>(); |
| | 1653 | 22 | | return optionsBuilder; |
| | | 23 | | } |
| | | 24 | | |
| | 1653 | 25 | | public static string GetMigrationsAssemblyName(this ElsaDbContextOptions? options, Assembly migrationsAssembly) => o |
| | 1653 | 26 | | public static string GetMigrationsHistoryTableName(this ElsaDbContextOptions? options) => options?.MigrationsHistory |
| | 1653 | 27 | | public static string GetSchemaName(this ElsaDbContextOptions? options) => options?.SchemaName ?? ElsaDbContextBase.E |
| | | 28 | | } |