-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30c27e0
commit 1cf18c8
Showing
200 changed files
with
53,069 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# ShoppingCartDemo | ||
The demo for the MSA approach using .NET stack | ||
### Service Discovery (Windows only) | ||
|
||
`consul.exe agent -dev` | ||
|
||
### Migration | ||
|
||
`dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Migrations/PersistedGrantDb` | ||
|
||
`dotnet ef migrations add InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Migrations/ConfigurationDb` | ||
|
||
`dotnet ef migrations add InitDatabase -c AppDbContext -o Migrations/SampleDb` | ||
|
||
`dotnet run` | ||
|
||
### Login | ||
|
||
`[email protected]` / `root` |
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,63 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26510.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NT.Infrastructure", "src\NT.Infrastructure\NT.Infrastructure.csproj", "{DABA5E01-B5C5-4325-9672-12B35E01CE24}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NT.Core", "src\NT.Core\NT.Core.csproj", "{88E28277-B9F7-4D1A-9150-8715BAA32213}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6CEABC5E-C3AD-45DE-9302-1321FCAD8033}" | ||
ProjectSection(SolutionItems) = preProject | ||
.gitignore = .gitignore | ||
LICENSE = LICENSE | ||
README.md = README.md | ||
ShoppingCartDemoCodeMap.dgml = ShoppingCartDemoCodeMap.dgml | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Externals", "Externals", "{8D3B46E9-34E0-4C7D-8E06-7221B6492406}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NT.MigrationConsole", "src\NT.MigrationConsole\NT.MigrationConsole.csproj", "{46C34DD5-0275-47B3-9B2A-5D922CDC50FF}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NT.IdentityServer", "src\NT.IdentityServer\NT.IdentityServer.csproj", "{10FD5B48-FBAF-4C9F-A0FA-6D389EA909E8}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "InternalServices", "InternalServices", "{2006F265-C085-4F5D-8EFE-29B15B8C003B}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NT.WebApi", "src\NT.WebApi\NT.WebApi.csproj", "{A7BBB2B3-F326-496A-98B8-A27B878361B0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{DABA5E01-B5C5-4325-9672-12B35E01CE24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{DABA5E01-B5C5-4325-9672-12B35E01CE24}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{DABA5E01-B5C5-4325-9672-12B35E01CE24}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{DABA5E01-B5C5-4325-9672-12B35E01CE24}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{88E28277-B9F7-4D1A-9150-8715BAA32213}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{88E28277-B9F7-4D1A-9150-8715BAA32213}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{88E28277-B9F7-4D1A-9150-8715BAA32213}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{88E28277-B9F7-4D1A-9150-8715BAA32213}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{46C34DD5-0275-47B3-9B2A-5D922CDC50FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{46C34DD5-0275-47B3-9B2A-5D922CDC50FF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{46C34DD5-0275-47B3-9B2A-5D922CDC50FF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{46C34DD5-0275-47B3-9B2A-5D922CDC50FF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{10FD5B48-FBAF-4C9F-A0FA-6D389EA909E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{10FD5B48-FBAF-4C9F-A0FA-6D389EA909E8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{10FD5B48-FBAF-4C9F-A0FA-6D389EA909E8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{10FD5B48-FBAF-4C9F-A0FA-6D389EA909E8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{A7BBB2B3-F326-496A-98B8-A27B878361B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A7BBB2B3-F326-496A-98B8-A27B878361B0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A7BBB2B3-F326-496A-98B8-A27B878361B0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A7BBB2B3-F326-496A-98B8-A27B878361B0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{46C34DD5-0275-47B3-9B2A-5D922CDC50FF} = {8D3B46E9-34E0-4C7D-8E06-7221B6492406} | ||
{10FD5B48-FBAF-4C9F-A0FA-6D389EA909E8} = {2006F265-C085-4F5D-8EFE-29B15B8C003B} | ||
{A7BBB2B3-F326-496A-98B8-A27B878361B0} = {2006F265-C085-4F5D-8EFE-29B15B8C003B} | ||
EndGlobalSection | ||
EndGlobal |
Large diffs are not rendered by default.
Oops, something went wrong.
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,14 @@ | ||
using System; | ||
|
||
namespace NT.Core.CatalogContext | ||
{ | ||
public class Product : EntityBase | ||
{ | ||
public string Name { get; set; } | ||
public int Quantity { get; set; } | ||
public double Price { get; set; } | ||
public string Model { get; set; } | ||
public DateTime DateAdded { get; set; } | ||
public Status Status { get; set; } | ||
} | ||
} |
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,8 @@ | ||
namespace NT.Core.CatalogContext | ||
{ | ||
public enum Status | ||
{ | ||
Review, | ||
Published | ||
} | ||
} |
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,13 @@ | ||
using NT.Core.SharedKernel; | ||
|
||
namespace NT.Core.CatalogContext | ||
{ | ||
public class Supplier : EntityBase | ||
{ | ||
public string CompanyName { get; set; } | ||
public string ContactName { get; set; } | ||
public string ContactTitle { get; set; } | ||
public AddressInfo AddressInfo { get; set; } | ||
public ContactInfo ContactInfo { get; set; } | ||
} | ||
} |
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,16 @@ | ||
using System; | ||
using NT.Core.SharedKernel; | ||
|
||
namespace NT.Core.CustomerContext | ||
{ | ||
public class Customer : EntityBase | ||
{ | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
public string ContactTitle { get; set; } | ||
public Guid AddressInfoId { get; set; } | ||
public AddressInfo AddressInfo { get; set; } | ||
public Guid ContactInfoId { get; set; } | ||
public ContactInfo ContactInfo { get; set; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/NT.Core/CustomerContext/CustomerWithAddressInfoSpec.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,18 @@ | ||
using System; | ||
using System.Linq.Expressions; | ||
|
||
namespace NT.Core.CustomerContext | ||
{ | ||
public class CustomerWithAddressInfoSpec : ISpecification<Customer> | ||
{ | ||
public Expression<Func<Customer, bool>> Criteria | ||
{ | ||
get { return e => true; } | ||
} | ||
|
||
public Expression<Func<Customer, object>> Include | ||
{ | ||
get { return e => e.AddressInfo; } | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/NT.Core/CustomerContext/CustomerWithContactInfoSpec.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,18 @@ | ||
using System; | ||
using System.Linq.Expressions; | ||
|
||
namespace NT.Core.CustomerContext | ||
{ | ||
public class CustomerWithContactInfoSpec : ISpecification<Customer> | ||
{ | ||
public Expression<Func<Customer, bool>> Criteria | ||
{ | ||
get { return e => true; } | ||
} | ||
|
||
public Expression<Func<Customer, object>> Include | ||
{ | ||
get { return e => e.ContactInfo; } | ||
} | ||
} | ||
} |
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,9 @@ | ||
using System; | ||
|
||
namespace NT.Core | ||
{ | ||
public abstract class EntityBase | ||
{ | ||
public Guid Id { get; set; } | ||
} | ||
} |
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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace NT.Core | ||
{ | ||
public interface IRepository<TEntity> where TEntity : EntityBase | ||
{ | ||
Task<TEntity> GetByIdAsync(Guid id); | ||
Task<IEnumerable<TEntity>> ListAsync(); | ||
Task<IEnumerable<TEntity>> ListAsync(ISpecification<TEntity>[] spec); | ||
Task<TEntity> AddAsync(TEntity entity); | ||
Task UpdateAsync(TEntity entity); | ||
Task DeleteAsync(TEntity entity); | ||
} | ||
} |
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,11 @@ | ||
using System; | ||
using System.Linq.Expressions; | ||
|
||
namespace NT.Core | ||
{ | ||
public interface ISpecification<TEntity> | ||
{ | ||
Expression<Func<TEntity, bool>> Criteria { get; } | ||
Expression<Func<TEntity, object>> Include { get; } | ||
} | ||
} |
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,9 @@ | ||
using System; | ||
|
||
namespace NT.Core | ||
{ | ||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] | ||
public class IgnoreMemberAttribute : Attribute | ||
{ | ||
} | ||
} |
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard1.4</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,8 @@ | ||
namespace NT.Core.NotificationContext | ||
{ | ||
public class Notification : EntityBase | ||
{ | ||
public NotificationInfo NotificationInfo { get; set; } | ||
public OrderLink Order { get; set; } | ||
} | ||
} |
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 @@ | ||
using System; | ||
|
||
namespace NT.Core.NotificationContext | ||
{ | ||
public class NotificationInfo : ValueObject | ||
{ | ||
public NotificationInfo(Guid id, string message) | ||
{ | ||
Id = id; | ||
Message = message; | ||
} | ||
|
||
public Guid Id { get; private set; } | ||
public string Message { get; private set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"Notification [id={Id}; message={Message}]"; | ||
} | ||
} | ||
} |
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,6 @@ | ||
namespace NT.Core.NotificationContext | ||
{ | ||
public class OrderLink : EntityBase | ||
{ | ||
} | ||
} |
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,6 @@ | ||
namespace NT.Core.OrderContext | ||
{ | ||
public class CustomerLink : EntityBase | ||
{ | ||
} | ||
} |
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,14 @@ | ||
using System; | ||
|
||
namespace NT.Core.OrderContext | ||
{ | ||
public class Order : EntityBase | ||
{ | ||
public CustomerLink Customer { get; set; } | ||
public Guid CustomerId { get; set; } | ||
public UserLink Employee { get; set; } | ||
public Guid EmployeeId { get; set; } | ||
public DateTime OrderDate { get; set; } | ||
public ShipInfo ShipInfo { get; set; } | ||
} | ||
} |
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,13 @@ | ||
using System; | ||
|
||
namespace NT.Core.OrderContext | ||
{ | ||
public class OrderDetails : EntityBase | ||
{ | ||
public Order Order { get; set; } | ||
public Guid OrderId { get; set; } | ||
public ProductLink Product { get; set; } | ||
public Guid ProductId { get; set; } | ||
public int Quantity { get; set; } | ||
} | ||
} |
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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace NT.Core.OrderContext | ||
{ | ||
public class ProductLink : EntityBase | ||
{ | ||
} | ||
} |
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,19 @@ | ||
using System; | ||
using NT.Core.SharedKernel; | ||
|
||
namespace NT.Core.OrderContext | ||
{ | ||
public class ShipInfo : ValueObject | ||
{ | ||
public ShipInfo(Guid id, string name, AddressInfo addressInfo) | ||
{ | ||
Id = id; | ||
Name = name; | ||
AddressInfo = addressInfo; | ||
} | ||
|
||
public Guid Id { get; private set; } | ||
public string Name { get; private set; } | ||
public AddressInfo AddressInfo { get; private set; } | ||
} | ||
} |
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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace NT.Core.OrderContext | ||
{ | ||
public class UserLink : EntityBase | ||
{ | ||
} | ||
} |
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,15 @@ | ||
using System; | ||
|
||
namespace NT.Core.PaymentContext | ||
{ | ||
public class CustomerPayment : EntityBase | ||
{ | ||
public PaymentCustomerLink Customer { get; set; } | ||
public Guid CustomerId { get; set; } | ||
public PaymentMethod PaymentMethod { get; set; } | ||
public Guid PaymentMethodId { get; set; } | ||
public string CardNumber { get; set; } | ||
public DateTime DateFrom { get; set; } | ||
public DateTime DateTo { get; set; } | ||
} | ||
} |
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,6 @@ | ||
namespace NT.Core.PaymentContext | ||
{ | ||
public class PaymentCustomerLink : EntityBase | ||
{ | ||
} | ||
} |
Oops, something went wrong.