Skip to content

Commit bf85a64

Browse files
committed
Added code docs
1 parent 6c745da commit bf85a64

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/EntityFrameworkCore.Triggered/Extensions/DbContextExtensions.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ namespace EntityFrameworkCore.Triggered.Extensions
88
{
99
public static class DbContextExtensions
1010
{
11+
/// <summary>
12+
/// Gets the <c>ITriggerService</c> that is used to create trigger sessions.Allows for just in time configuration
13+
/// </summary>
1114
public static ITriggerService GetTriggerService(this DbContext dbContext)
1215
{
1316
if (dbContext is null)
@@ -18,13 +21,19 @@ public static ITriggerService GetTriggerService(this DbContext dbContext)
1821
return dbContext.GetService<ITriggerService>() ?? throw new InvalidOperationException("Triggers are not configured for this DbContext");
1922
}
2023

24+
/// <summary>
25+
/// Gets or creates a <c>ITriggerSession</c> that can be used to manually invoke triggers
26+
/// </summary>
2127
public static ITriggerSession CreateTriggerSession(this DbContext dbContext, IServiceProvider? serviceProvider = null)
2228
{
2329
var triggerService = GetTriggerService(dbContext);
2430

2531
return triggerService.CreateSession(dbContext, serviceProvider);
2632
}
2733

34+
/// <summary>
35+
/// Calls dbContext.SaveChanges without invoking triggers
36+
/// </summary>
2837
public static int SaveChangesWithoutTriggers(this DbContext dbContext, bool acceptAllChangesOnSuccess = true)
2938
{
3039
var triggerService = GetTriggerService(dbContext);
@@ -42,9 +51,15 @@ public static int SaveChangesWithoutTriggers(this DbContext dbContext, bool acce
4251
}
4352
}
4453

54+
/// <summary>
55+
/// Calls dbContext.SaveChanges without invoking triggers
56+
/// </summary>
4557
public static Task<int> SaveChangesWithoutTriggersAsync(this DbContext dbContext, CancellationToken cancellationToken = default)
4658
=> SaveChangesWithoutTriggersAsync(dbContext, true, cancellationToken);
4759

60+
/// <summary>
61+
/// Calls dbContext.SaveChanges without invoking triggers
62+
/// </summary>
4863
public static Task<int> SaveChangesWithoutTriggersAsync(this DbContext dbContext, bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default)
4964
{
5065
var triggerService = GetTriggerService(dbContext);

0 commit comments

Comments
 (0)