| | | 1 | | using Elsa.Common.Entities; |
| | | 2 | | using Microsoft.EntityFrameworkCore; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Persistence.EFCore; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// A generic repository class around EF Core for accessing entities that inherit from <see cref="Entity"/>. |
| | | 8 | | /// </summary> |
| | | 9 | | /// <typeparam name="TDbContext">The type of the database context.</typeparam> |
| | | 10 | | /// <typeparam name="TEntity">The type of the entity.</typeparam> |
| | | 11 | | public class EntityStore<TDbContext, TEntity>(IDbContextFactory<TDbContext> dbContextFactory, IServiceProvider servicePr |
| | 2255 | 12 | | : Store<TDbContext, TEntity>(dbContextFactory, serviceProvider) where TDbContext : DbContext where TEntity : Entity, |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Saves the entity. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <param name="entity">The entity to save.</param> |
| | | 18 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | 0 | 19 | | public async Task SaveAsync(TEntity entity, CancellationToken cancellationToken = default) => await SaveAsync(entity |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Saves the entity. |
| | | 23 | | /// </summary> |
| | | 24 | | /// <param name="entity">The entity to save.</param> |
| | | 25 | | /// <param name="onSaving">The callback to invoke before saving the entity.</param> |
| | | 26 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | 360 | 27 | | public async Task SaveAsync(TEntity entity, Func<TDbContext, TEntity, CancellationToken, ValueTask>? onSaving, Cance |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Saves the specified entities. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="entities">The entities to save.</param> |
| | | 33 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | 0 | 34 | | public async Task SaveManyAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default) => awa |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Saves the specified entities. |
| | | 38 | | /// </summary> |
| | | 39 | | /// <param name="entities">The entities to save.</param> |
| | | 40 | | /// <param name="onSaving">The callback to invoke before saving the entities.</param> |
| | | 41 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | 1385 | 42 | | public async Task SaveManyAsync(IEnumerable<TEntity> entities, Func<TDbContext, TEntity, CancellationToken, ValueTas |
| | | 43 | | } |