-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/3.21.0' into master
- Loading branch information
Showing
10 changed files
with
206 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# How-to extend rounding policy | ||
## 1. Implement the intefrace VirtoCommerce.CoreModule.Core.Currency.IMoneyRoundingPolicy | ||
```csharp | ||
public class CustomMoneyRoundingPolicy : IMoneyRoundingPolicy | ||
{ | ||
public decimal RoundMoney(decimal amount, Currency currency) | ||
{ | ||
// Some rounding logic | ||
} | ||
} | ||
``` | ||
## 2. Register it with the DI container in Module.cs | ||
```csharp | ||
public void Initialize(IServiceCollection serviceCollection) | ||
{ | ||
... | ||
|
||
// Money rounding | ||
serviceCollection.AddTransient<IMoneyRoundingPolicy, CustomMoneyRoundingPolicy>(); | ||
} | ||
``` |
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
139 changes: 139 additions & 0 deletions
139
...toCommerce.CoreModule.Data/Migrations/20210819064242_ExtendedMidpointRounding.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
src/VirtoCommerce.CoreModule.Data/Migrations/20210819064242_ExtendedMidpointRounding.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
namespace VirtoCommerce.CoreModule.Data.Migrations | ||
{ | ||
public partial class ExtendedMidpointRounding : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AlterColumn<string>( | ||
name: "MidpointRounding", | ||
table: "Currency", | ||
maxLength: 18, | ||
nullable: true, | ||
oldClrType: typeof(string), | ||
oldType: "nvarchar(16)", | ||
oldMaxLength: 16, | ||
oldNullable: true); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AlterColumn<string>( | ||
name: "MidpointRounding", | ||
table: "Currency", | ||
type: "nvarchar(16)", | ||
maxLength: 16, | ||
nullable: true, | ||
oldClrType: typeof(string), | ||
oldMaxLength: 18, | ||
oldNullable: true); | ||
} | ||
} | ||
} |
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