Skip to content

Commit 7ce25f8

Browse files
Merge pull request #44 from nullinside-development-group/feature/Poc2Prod
Adding more commonly used methods to db interface
2 parents 2f9156b + 9ba106b commit 7ce25f8

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/Nullinside.Api.Model/INullinsideContext.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,56 @@ namespace Nullinside.Api.Model;
88
/// <summary>
99
/// Represents the nullinside database.
1010
/// </summary>
11-
public interface INullinsideContext {
11+
public interface INullinsideContext : IAsyncDisposable {
1212
/// <summary>
1313
/// The users table which contains all of the users that have ever authenticated with the site.
1414
/// </summary>
15-
public DbSet<User> Users { get; set; }
15+
DbSet<User> Users { get; set; }
1616

1717
/// <summary>
1818
/// The user's roles table which contains all of the "roles" the user has in the application.
1919
/// </summary>
20-
public DbSet<UserRole> UserRoles { get; set; }
20+
DbSet<UserRole> UserRoles { get; set; }
2121

2222
/// <summary>
2323
/// The docker deployments that are configurable in the applications.
2424
/// </summary>
25-
public DbSet<DockerDeployments> DockerDeployments { get; set; }
25+
DbSet<DockerDeployments> DockerDeployments { get; set; }
2626

2727
/// <summary>
2828
/// The docker deployments that are configurable in the applications.
2929
/// </summary>
30-
public DbSet<TwitchUser> TwitchUser { get; set; }
30+
DbSet<TwitchUser> TwitchUser { get; set; }
3131

3232
/// <summary>
3333
/// The docker deployments that are configurable in the applications.
3434
/// </summary>
35-
public DbSet<TwitchBan> TwitchBan { get; set; }
35+
DbSet<TwitchBan> TwitchBan { get; set; }
3636

3737
/// <summary>
3838
/// The feature toggles.
3939
/// </summary>
40-
public DbSet<FeatureToggle> FeatureToggle { get; set; }
40+
DbSet<FeatureToggle> FeatureToggle { get; set; }
4141

4242
/// <summary>
4343
/// The twitch user configuration.
4444
/// </summary>
45-
public DbSet<TwitchUserConfig> TwitchUserConfig { get; set; }
45+
DbSet<TwitchUserConfig> TwitchUserConfig { get; set; }
4646

4747
/// <summary>
4848
/// The twitch logs of users banned outside the bot.
4949
/// </summary>
50-
public DbSet<TwitchUserBannedOutsideOfBotLogs> TwitchUserBannedOutsideOfBotLogs { get; set; }
50+
DbSet<TwitchUserBannedOutsideOfBotLogs> TwitchUserBannedOutsideOfBotLogs { get; set; }
5151

5252
/// <summary>
5353
/// The twitch logs of the user's chat.
5454
/// </summary>
55-
public DbSet<TwitchUserChatLogs> TwitchUserChatLogs { get; set; }
55+
DbSet<TwitchUserChatLogs> TwitchUserChatLogs { get; set; }
5656

5757
/// <summary>
5858
/// Provides access to database related information and operations for this context.
5959
/// </summary>
60-
public DatabaseFacade Database { get; }
60+
DatabaseFacade Database { get; }
6161

6262
/// <summary>
6363
/// Saves all changes made in this context to the database.
@@ -67,5 +67,13 @@ public interface INullinsideContext {
6767
/// A task that represents the asynchronous save operation. The task result contains the
6868
/// number of state entries written to the database.
6969
/// </returns>
70-
public Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
70+
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
71+
72+
/// <summary>
73+
/// Saves all changes made in this context to the database.
74+
/// </summary>
75+
/// <returns>
76+
/// The number of state entries written to the database.
77+
/// </returns>
78+
int SaveChanges();
7179
}

0 commit comments

Comments
 (0)