-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from dstantotalsoft/master
add cancellationtoken for each async method + some cleaning code
- Loading branch information
Showing
124 changed files
with
557 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
...les/MicroServices/NBB.Contracts/NBB.Contracts.Migrations/ContractsReadDatabaseMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace NBB.Contracts.Migrations | ||
{ | ||
public class ContractsReadDatabaseMigrator | ||
{ | ||
public async Task MigrateDatabaseToLatestVersion(string[] args) | ||
public async Task MigrateDatabaseToLatestVersion(string[] args, CancellationToken cancellationToken = default) | ||
{ | ||
var dbContext = new ContractsReadDbContextFactory().CreateDbContext(args); | ||
await dbContext.Database.EnsureCreatedAsync(); | ||
await dbContext.Database.EnsureCreatedAsync(cancellationToken); | ||
} | ||
|
||
public async Task EnsureDatabaseDeleted(string[] args) | ||
public async Task EnsureDatabaseDeleted(string[] args, CancellationToken cancellationToken = default) | ||
{ | ||
var dbContext = new ContractsReadDbContextFactory().CreateDbContext(args); | ||
await dbContext.Database.EnsureDeletedAsync(); | ||
await dbContext.Database.EnsureDeletedAsync(cancellationToken); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
samples/MicroServices/NBB.Invoices/NBB.Invoices.Api/Controllers/InvoicesController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...les/MicroServices/NBB.Invoices/NBB.Invoices.Domain/InvoiceAggregate/IInvoiceRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace NBB.Invoices.Domain.InvoiceAggregate | ||
{ | ||
public interface IInvoiceRepository | ||
{ | ||
Task<Invoice> GetByIdAsync(Guid id); | ||
Task AddAsync(Invoice invoice); | ||
Task SaveChangesAsync(); | ||
Task<Invoice> GetByIdAsync(Guid id, CancellationToken cancellationToken = default); | ||
Task AddAsync(Invoice invoice, CancellationToken cancellationToken = default); | ||
Task SaveChangesAsync(CancellationToken cancellationToken = default); | ||
} | ||
} |
11 changes: 6 additions & 5 deletions
11
samples/MicroServices/NBB.Invoices/NBB.Invoices.Migrations/InvoicesDatabaseMigrator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace NBB.Invoices.Migrations | ||
{ | ||
public class InvoicesDatabaseMigrator | ||
{ | ||
public async Task MigrateDatabaseToLatestVersion(string[] args) | ||
public async Task MigrateDatabaseToLatestVersion(string[] args, CancellationToken cancellationToken = default) | ||
{ | ||
var dbContext = new InvoicesDbContextFactory().CreateDbContext(args); | ||
await dbContext.Database.MigrateAsync(); | ||
await dbContext.Database.MigrateAsync(cancellationToken); | ||
} | ||
|
||
public async Task EnsureDatabaseDeleted(string[] args) | ||
public async Task EnsureDatabaseDeleted(string[] args, CancellationToken cancellationToken = default) | ||
{ | ||
var dbContext = new InvoicesDbContextFactory().CreateDbContext(args); | ||
await dbContext.Database.EnsureDeletedAsync(); | ||
await dbContext.Database.EnsureDeletedAsync(cancellationToken); | ||
} | ||
} | ||
} |
Oops, something went wrong.