├── ModularMonolith
├── Framework
│ ├── Shop.Framework.Entities
│ │ ├── Shop.Framework.Entities.csproj
│ │ ├── Aggregate.cs
│ │ ├── Entity.cs
│ │ └── DomainException.cs
│ ├── Shop.Framework.Interfaces
│ │ ├── Shop.Framework.UseCases.Interfaces.csproj
│ │ ├── Transactions
│ │ │ └── ITransactionalRequest.cs
│ │ ├── Exceptions
│ │ │ └── EntityNotFoundException.cs
│ │ └── Services
│ │ │ ├── ICurrentUserService.cs
│ │ │ └── IConnectionFactory.cs
│ ├── Shop.Utils
│ │ ├── Extensions
│ │ │ └── StringExtensions.cs
│ │ ├── Shop.Utils.csproj
│ │ └── Modules
│ │ │ ├── Module.cs
│ │ │ └── ServiceCollectionExtensions.cs
│ └── Shop.Framework.Implementation
│ │ ├── Shop.Framework.UseCases.Implementation.csproj
│ │ ├── FrameworkModule.cs
│ │ └── Services
│ │ ├── CurrentUserService.cs
│ │ └── ConnectionFactory.cs
├── Infrastructure
│ ├── Shop.Email.Interfaces
│ │ ├── Shop.Emails.Interfaces.csproj
│ │ ├── IEmailService.cs
│ │ └── EmailOptions.cs
│ └── Shop.Email.Implementation
│ │ ├── EmailOptions.cs
│ │ ├── EmailModule.cs
│ │ ├── Shop.Emails.Implementation.csproj
│ │ └── EmailService.cs
├── Communication
│ ├── Shop.Communication.Contract
│ │ ├── Shop.Communication.Contract.csproj
│ │ └── ICommunicationContract.cs
│ ├── Shop.Communication.Controllers
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Shop.Communication.Controllers.csproj
│ │ └── EmailrsController.cs
│ ├── Shop.Communication.DataAccess.MsSql
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Shop.Communication.DataAccess.MsSql.csproj
│ │ ├── CommunicationDbContext.cs
│ │ ├── CommunicationDataAccessModule.cs
│ │ └── Migrations
│ │ │ ├── 20200315150453_Communication_Initial.cs
│ │ │ ├── CommunicationDbContextModelSnapshot.cs
│ │ │ └── 20200315150453_Communication_Initial.Designer.cs
│ ├── Shop.Communication.UseCases
│ │ ├── ICommunicationRequest.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Emails
│ │ │ ├── Queries
│ │ │ │ └── GetEmails
│ │ │ │ │ ├── GetEmailsRequest.cs
│ │ │ │ │ └── GetEmailsRequestHandler.cs
│ │ │ ├── Mappings
│ │ │ │ └── EmailsAutoMapperProfile.cs
│ │ │ ├── Dto
│ │ │ │ └── EmailDto.cs
│ │ │ └── NotificationHandlers
│ │ │ │ └── OrderCreatedNotificationHandler.cs
│ │ ├── CommunicationUseCasesModule.cs
│ │ └── Shop.Communication.UseCases.csproj
│ ├── Shop.Communication.Entities
│ │ ├── Shop.Communication.Entities.csproj
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Email.cs
│ ├── Shop.Communication.Infrastructure.Implementation
│ │ ├── BackgroundJobs
│ │ │ ├── CommunicationJobRegistry.cs
│ │ │ └── SendEmailsJob.cs
│ │ ├── CommunicationInfrastructureModule.cs
│ │ └── Shop.Communication.BackgroundJobs.csproj
│ ├── Shop.Communication.Infrastructure.Interfaces
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Shop.Communication.DataAccess.Interfaces.csproj
│ │ └── ICommunicationDbContext.cs
│ └── Shop.Communication.Contract.Implementation
│ │ ├── Shop.Communication.Contract.Implementation.csproj
│ │ ├── CommunicationContractModule.cs
│ │ └── CommunicationContract.cs
├── Order
│ ├── Shop.Order.UseCases
│ │ ├── IOrderRequest.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Orders
│ │ │ ├── Dto
│ │ │ │ ├── CreateOrderDto.cs
│ │ │ │ ├── OrderDto.cs
│ │ │ │ └── OrderItemDto.cs
│ │ │ ├── Commands
│ │ │ │ ├── UpdateOrder
│ │ │ │ │ ├── UpdateOrderRequest.cs
│ │ │ │ │ └── UpdateOrderRequestHandler.cs
│ │ │ │ └── CreateOrder
│ │ │ │ │ ├── CreateOrderRequest.cs
│ │ │ │ │ └── CreateOrderRequestHandler.cs
│ │ │ ├── Queries
│ │ │ │ └── GetOrder
│ │ │ │ │ ├── GetOrderRequest.cs
│ │ │ │ │ └── GetOrderRequestHandler.cs
│ │ │ └── Mappings
│ │ │ │ └── OrdersAutoMapperProfile.cs
│ │ ├── OrderUseCasesModule.cs
│ │ └── Shop.Order.UseCases.csproj
│ ├── Shop.Order.Controllers
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Shop.Order.Controllers.csproj
│ │ └── OrdersController.cs
│ ├── Shop.Order.DataAccess.MsSql
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Shop.Order.DataAccess.MsSql.csproj
│ │ ├── OrderDataAccessModule.cs
│ │ ├── OrderDbContext.cs
│ │ └── Migrations
│ │ │ ├── OrderDbContextModelSnapshot.cs
│ │ │ ├── 20200315150200_Order_Initial.cs
│ │ │ └── 20200315150200_Order_Initial.Designer.cs
│ ├── Shop.Order.Contract.Implementation
│ │ ├── OrderContract.cs
│ │ ├── Shop.Order.Contract.Implementation.csproj
│ │ └── OrderContractModule.cs
│ ├── Shop.Order.Contract
│ │ ├── IOrderContract.cs
│ │ ├── Shop.Order.Contract.csproj
│ │ └── Notifications
│ │ │ └── OrderCreatedNotification.cs
│ ├── Shop.Order.Infrastructure.Interfaces
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Shop.Order.DataAccess.Interfaces.csproj
│ │ └── IOrderDbContext.cs
│ └── Shop.Order.Entities
│ │ ├── Shop.Order.Entities.csproj
│ │ ├── Product.cs
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── OrderItem.cs
│ │ └── Order.cs
├── Shop.Web
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Utils
│ │ ├── InternalControllerFeatureProvider.cs
│ │ ├── DbTransactionPipelineBehavior.cs
│ │ └── ExceptionHandlerMiddleware.cs
│ ├── BackgroundJobsConfig
│ │ └── JobFactory.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── Shop.Web.csproj
│ └── Startup.cs
├── Directory.Build.props
├── update-database.ps1
├── Shop.Tests.Unit
│ ├── appsettings.json
│ ├── Shop.Tests.Unit.csproj
│ ├── ArchitectureTests.cs
│ ├── WorkflowTests.cs
│ └── TransactionsTests.cs
├── Tools
│ └── ModularMonolithAnalyzer
│ │ ├── ModularMonolithAnalyzer.Vsix
│ │ ├── source.extension.vsixmanifest
│ │ └── ModularMonolithAnalyzer.Vsix.csproj
│ │ └── ModularMonolithAnalyzer
│ │ ├── tools
│ │ ├── install.ps1
│ │ └── uninstall.ps1
│ │ ├── ModularMonolithAnalyzer.csproj
│ │ └── ModularMonolithAnalyzerAnalyzer.cs
├── CreateDatabase.sql
└── ModularMonolith.sln
├── README.md
├── .gitattributes
└── .gitignore
/ModularMonolith/Framework/Shop.Framework.Entities/Shop.Framework.Entities.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Interfaces/Shop.Emails.Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Contract/Shop.Communication.Contract.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Interfaces/Shop.Framework.UseCases.Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/IOrderRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Order.UseCases
2 | {
3 | internal interface IOrderRequest
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Controllers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Web")]
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Tests.Unit")]
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Entities/Aggregate.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Framework.Entities
2 | {
3 | public abstract class Aggregate : Entity
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Controllers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Web")]
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Tests.Unit")]
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/ICommunicationRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Communication.UseCases
2 | {
3 | internal interface ICommunicationRequest
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Entities/Entity.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Framework.Entities
2 | {
3 | public abstract class Entity
4 | {
5 | public int Id { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Contract.Implementation/OrderContract.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Order.Contract.Implementation
2 | {
3 | internal class OrderContract : IOrderContract
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Entities/DomainException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Shop.Framework.Entities
4 | {
5 | public abstract class DomainException : Exception
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Interfaces/Transactions/ITransactionalRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Framework.UseCases.Interfaces.Transactions
2 | {
3 | public interface ITransactionalRequest
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Contract/IOrderContract.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Order.Contract
2 | {
3 | //Only for other modules, but not for controllers
4 | public interface IOrderContract
5 | {
6 |
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Order.Controllers")]
4 |
5 | [assembly: InternalsVisibleTo("Shop.Tests.Unit")]
6 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ModularMonolith/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | latest
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Contract/Shop.Order.Contract.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Dto/CreateOrderDto.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Order.UseCases.Orders.Dto
2 | {
3 | internal class CreateOrderDto
4 | {
5 | public OrderItemDto[] Items { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Interfaces/Exceptions/EntityNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Shop.Framework.UseCases.Interfaces.Exceptions
4 | {
5 | public class EntityNotFoundException : Exception
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Infrastructure.Interfaces/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Order.UseCases")]
4 | [assembly: InternalsVisibleTo("Shop.Order.DataAccess.MsSql")]
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Entities/Shop.Order.Entities.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Commands/UpdateOrder/UpdateOrderRequest.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Shop.Order.UseCases.Orders.Commands.UpdateOrder
4 | {
5 | internal class UpdateOrderRequest : IRequest, IOrderRequest
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Communication.Contract.Implementation")]
4 | [assembly: InternalsVisibleTo("Shop.Communication.Controllers")]
5 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Interfaces/IEmailService.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Shop.Emails.Interfaces
4 | {
5 | public interface IEmailService
6 | {
7 | Task SendEmailAsync(string email, string subject, string body);
8 | }
9 | }
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Contract/Notifications/OrderCreatedNotification.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 |
3 | namespace Shop.Order.Contract.Notifications
4 | {
5 | public record OrderCreatedNotification(int OrderId, int UserId, string UserEmail) : INotification
6 | {
7 | }
8 | }
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Entities/Shop.Communication.Entities.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Entities/Product.cs:
--------------------------------------------------------------------------------
1 | using Shop.Framework.Entities;
2 |
3 | namespace Shop.Order.Entities
4 | {
5 | internal class Product : Aggregate
6 | {
7 | public string Name { get; set; }
8 |
9 | public decimal Price { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ModularMonolith/update-database.ps1:
--------------------------------------------------------------------------------
1 | dotnet ef database update --context OrderDbContext --project Order\Shop.Order.DataAccess.MsSql --startup-project Shop.Web
2 | dotnet ef database update --context CommunicationDbContext --project Communication\Shop.Communication.DataAccess.MsSql --startup-project Shop.Web
3 |
4 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Dto/OrderDto.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Order.UseCases.Orders.Dto
2 | {
3 | internal class OrderDto
4 | {
5 | public int Id { get; set; }
6 | public decimal Price { get; set; }
7 | public int EmailsCount { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Utils/Extensions/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Utils.Extensions
2 | {
3 | public static class StringExtensions
4 | {
5 | public static bool IsEmpty(this string value)
6 | {
7 | return string.IsNullOrEmpty(value);
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Interfaces/Services/ICurrentUserService.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Framework.UseCases.Interfaces.Services
2 | {
3 | public interface ICurrentUserService
4 | {
5 | int Id { get; }
6 | bool IsAuthenticated { get; }
7 | string Email { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Utils/Shop.Utils.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Queries/GetOrder/GetOrderRequest.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 | using Shop.Order.UseCases.Orders.Dto;
3 |
4 | namespace Shop.Order.UseCases.Orders.Queries.GetOrder
5 | {
6 | internal class GetOrderRequest : IRequest, IOrderRequest
7 | {
8 | public int Id { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Emails/Queries/GetEmails/GetEmailsRequest.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 | using Shop.Communication.UseCases.Emails.Dto;
3 |
4 | namespace Shop.Communication.UseCases.Emails.Queries.GetEmails
5 | {
6 | internal class GetEmailsRequest : IRequest, ICommunicationRequest
7 | {
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/OrderUseCasesModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Shop.Utils.Modules;
3 |
4 | namespace Shop.Order.UseCases
5 | {
6 | public class OrderUseCasesModule : Module
7 | {
8 | public override void Load(IServiceCollection services)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Contract/ICommunicationContract.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace Shop.Communication.Contract
5 | {
6 | public interface ICommunicationContract
7 | {
8 | Task GetOrderEmailsCountAsync(int orderId, CancellationToken cancellationToken);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Tests.Unit/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "MsSqlConnection": "Data Source=.;Initial Catalog=ModularMonolith;Integrated Security=True"
4 | },
5 | "EmailOptions": {
6 | "Server": "server",
7 | "Port": 465,
8 | "Email": "email",
9 | "Password": "password",
10 | "FromName": "My shop autoinformator"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Dto/OrderItemDto.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 |
4 | namespace Shop.Order.UseCases.Orders.Dto
5 | {
6 | internal class OrderItemDto
7 | {
8 | public int ProductId { get; set; }
9 |
10 | [Range(1, Int32.MaxValue)]
11 | public int Count { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Utils/Modules/Module.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Configuration;
2 | using Microsoft.Extensions.DependencyInjection;
3 |
4 | namespace Shop.Utils.Modules
5 | {
6 | public abstract class Module
7 | {
8 | public IConfiguration Configuration { get; set; }
9 |
10 | public abstract void Load(IServiceCollection services);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/CommunicationUseCasesModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Shop.Utils.Modules;
3 |
4 | namespace Shop.Communication.UseCases
5 | {
6 | public class CommunicationUseCasesModule : Module
7 | {
8 | public override void Load(IServiceCollection services)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Interfaces/EmailOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Emails.Interfaces
2 | {
3 | public class EmailOptions
4 | {
5 | public string Server { get; set; }
6 | public int Port { get; set; }
7 | public string Email { get; set; }
8 | public string Password { get; set; }
9 | public string FromName { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Implementation/EmailOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Emails.Implementation
2 | {
3 | internal class EmailOptions
4 | {
5 | public string Server { get; set; }
6 | public int Port { get; set; }
7 | public string Email { get; set; }
8 | public string Password { get; set; }
9 | public string FromName { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Infrastructure.Interfaces/Shop.Order.DataAccess.Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Contract.Implementation/Shop.Order.Contract.Implementation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Implementation/BackgroundJobs/CommunicationJobRegistry.cs:
--------------------------------------------------------------------------------
1 | using FluentScheduler;
2 |
3 | namespace Shop.Communication.BackgroundJobs.BackgroundJobs
4 | {
5 | internal class CommunicationJobRegistry : Registry
6 | {
7 | public CommunicationJobRegistry()
8 | {
9 | //Schedule().NonReentrant().ToRunEvery(1).Minutes();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Interfaces/Services/IConnectionFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data.Common;
3 |
4 | namespace Shop.Framework.UseCases.Interfaces.Services
5 | {
6 | public interface IConnectionFactory : IDisposable
7 | {
8 | DbConnection GetConnection();
9 | DbTransaction GetTransaction();
10 | bool IsConnectionOpened { get; }
11 | bool IsTransactionStarted { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Contract.Implementation/OrderContractModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Shop.Utils.Modules;
3 |
4 | namespace Shop.Order.Contract.Implementation
5 | {
6 | public class OrderContractModule : Module
7 | {
8 | public override void Load(IServiceCollection services)
9 | {
10 | services.AddScoped();
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Commands/CreateOrder/CreateOrderRequest.cs:
--------------------------------------------------------------------------------
1 | using MediatR;
2 | using Shop.Framework.UseCases.Interfaces.Transactions;
3 | using Shop.Order.UseCases.Orders.Dto;
4 |
5 | namespace Shop.Order.UseCases.Orders.Commands.CreateOrder
6 | {
7 | internal class CreateOrderRequest : IRequest, ITransactionalRequest, IOrderRequest
8 | {
9 | public CreateOrderDto CreateOrderDto { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Controllers/Shop.Order.Controllers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Interfaces/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Communication.BackgroundJobs")]
4 | [assembly: InternalsVisibleTo("Shop.Communication.DataAccess.MsSql")]
5 | [assembly: InternalsVisibleTo("Shop.Communication.UseCases")]
6 | [assembly: InternalsVisibleTo("Shop.Communication.Contract.Implementation")]
7 |
8 | [assembly: InternalsVisibleTo("Shop.Tests.Unit")]
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Emails/Mappings/EmailsAutoMapperProfile.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using Shop.Communication.Entities;
3 | using Shop.Communication.UseCases.Emails.Dto;
4 |
5 | namespace Shop.Communication.UseCases.Emails.Mappings
6 | {
7 | internal class EmailsAutoMapperProfile : Profile
8 | {
9 | public EmailsAutoMapperProfile()
10 | {
11 | CreateMap();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "MsSqlConnection": "Data Source=.;Initial Catalog=ModularMonolith;Integrated Security=True"
4 | },
5 | "EmailOptions": {
6 | "Server": "server",
7 | "Port": 465,
8 | "Email": "email",
9 | "Password": "password",
10 | "FromName": "My shop autoinformator"
11 | },
12 | "Logging": {
13 | "LogLevel": {
14 | "Default": "Warning"
15 | }
16 | },
17 | "AllowedHosts": "*"
18 | }
19 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Utils/InternalControllerFeatureProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using Microsoft.AspNetCore.Mvc;
3 | using Microsoft.AspNetCore.Mvc.Controllers;
4 |
5 | namespace Shop.Web.Utils
6 | {
7 | public class InternalControllerFeatureProvider : ControllerFeatureProvider
8 | {
9 | protected override bool IsController(TypeInfo typeInfo)
10 | {
11 | return typeof(ControllerBase).IsAssignableFrom(typeInfo);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Entities/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Order.DomainServices.Interfaces")]
4 | [assembly: InternalsVisibleTo("Shop.Order.DomainServices.Implementation")]
5 | [assembly: InternalsVisibleTo("Shop.Order.DataAccess.Interfaces")]
6 | [assembly: InternalsVisibleTo("Shop.Order.DataAccess.MsSql")]
7 | [assembly: InternalsVisibleTo("Shop.Order.UseCases")]
8 |
9 | [assembly: InternalsVisibleTo("Shop.Tests.Unit")]
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Contract.Implementation/Shop.Communication.Contract.Implementation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Contract.Implementation/CommunicationContractModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Shop.Utils.Modules;
3 |
4 | namespace Shop.Communication.Contract.Implementation
5 | {
6 | public class CommunicationContractModule : Module
7 | {
8 | public override void Load(IServiceCollection services)
9 | {
10 | services.AddScoped();
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Controllers/Shop.Communication.Controllers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Infrastructure.Interfaces/IOrderDbContext.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Microsoft.EntityFrameworkCore;
4 | using Shop.Order.Entities;
5 |
6 | namespace Shop.Order.DataAccess.Interfaces
7 | {
8 | internal interface IOrderDbContext
9 | {
10 | DbSet Orders { get; set; }
11 |
12 | DbSet Products { get; set; }
13 |
14 | Task SaveChangesAsync(CancellationToken token = default);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Commands/UpdateOrder/UpdateOrderRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using MediatR;
4 |
5 | namespace Shop.Order.UseCases.Orders.Commands.UpdateOrder
6 | {
7 | internal class UpdateOrderRequestHandler : IRequestHandler
8 | {
9 | public Task Handle(UpdateOrderRequest request, CancellationToken cancellationToken)
10 | {
11 | return Task.CompletedTask;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Interfaces/Shop.Communication.DataAccess.Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Entities/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("Shop.Communication.BackgroundJobs")]
4 | [assembly: InternalsVisibleTo("Shop.Communication.DataAccess.Interfaces")]
5 | [assembly: InternalsVisibleTo("Shop.Communication.DataAccess.MsSql")]
6 | [assembly: InternalsVisibleTo("Shop.Communication.UseCases")]
7 | [assembly: InternalsVisibleTo("Shop.Communication.Contract.Implementation")]
8 |
9 | [assembly: InternalsVisibleTo("Shop.Tests.Unit")]
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Interfaces/ICommunicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Microsoft.EntityFrameworkCore;
4 | using Shop.Communication.Entities;
5 |
6 | namespace Shop.Communication.DataAccess.Interfaces
7 | {
8 | internal interface ICommunicationDbContext
9 | {
10 | DbSet Emails { get; set; }
11 |
12 | int SaveChanges();
13 |
14 | Task SaveChangesAsync(CancellationToken token = default);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Emails/Dto/EmailDto.cs:
--------------------------------------------------------------------------------
1 | namespace Shop.Communication.UseCases.Emails.Dto
2 | {
3 | internal class EmailDto
4 | {
5 | public int Id { get; set; }
6 | public string Address { get; set; }
7 | public string Subject { get; set; }
8 | public string Body { get; set; }
9 | public bool IsSended { get; set; }
10 | public int Attempts { get; set; }
11 | public int UserId { get; set; }
12 | public int OrderId { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Implementation/EmailModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using Shop.Emails.Interfaces;
3 | using Shop.Utils.Modules;
4 |
5 | namespace Shop.Emails.Implementation
6 | {
7 | public class EmailModule : Module
8 | {
9 | public override void Load(IServiceCollection services)
10 | {
11 | services.AddScoped();
12 |
13 | services.Configure(Configuration.GetSection("EmailOptions"));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Entities/Email.cs:
--------------------------------------------------------------------------------
1 | using Shop.Framework.Entities;
2 |
3 | namespace Shop.Communication.Entities
4 | {
5 | internal class Email : Aggregate
6 | {
7 | public int Id { get; set; }
8 | public string Address { get; set; }
9 | public string Subject { get; set; }
10 | public string Body { get; set; }
11 | public bool IsSended { get; set; }
12 | public int Attempts { get; set; }
13 | public int UserId { get; set; }
14 | public int OrderId { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Entities/OrderItem.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using Shop.Framework.Entities;
3 |
4 | namespace Shop.Order.Entities
5 | {
6 | internal class OrderItem : Entity
7 | {
8 | public int OrderId { get; set; }
9 |
10 | [Required]
11 | public Order Order { get; set; }
12 |
13 |
14 | public int ProductId { get; set; }
15 |
16 | [Required]
17 | public Product Product { get; set; }
18 |
19 | [Range(1, int.MaxValue)]
20 | public int Count { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Implementation/Shop.Emails.Implementation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Entities/Order.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Shop.Framework.Entities;
5 |
6 | namespace Shop.Order.Entities
7 | {
8 | internal class Order : Aggregate
9 | {
10 | public DateTime CreationDate { get; set; }
11 |
12 | public int UserId { get; set; }
13 |
14 | public ICollection Items { get; private set; } = new HashSet();
15 |
16 | public decimal GetPrice()
17 | {
18 | return Items.Sum(x => x.Count * x.Product.Price);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Mappings/OrdersAutoMapperProfile.cs:
--------------------------------------------------------------------------------
1 | using AutoMapper;
2 | using Shop.Order.Entities;
3 | using Shop.Order.UseCases.Orders.Dto;
4 |
5 | namespace Shop.Order.UseCases.Orders.Mappings
6 | {
7 | internal class OrdersAutoMapperProfile : Profile
8 | {
9 | public OrdersAutoMapperProfile()
10 | {
11 | CreateMap()
12 | .ForMember(x => x.Price, opt => opt.Ignore());
13 |
14 | CreateMap();
15 | CreateMap();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Implementation/CommunicationInfrastructureModule.cs:
--------------------------------------------------------------------------------
1 | using FluentScheduler;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Shop.Communication.BackgroundJobs.BackgroundJobs;
4 | using Shop.Utils.Modules;
5 |
6 | namespace Shop.Communication.BackgroundJobs
7 | {
8 | public class CommunicationInfrastructureModule : Module
9 | {
10 | public override void Load(IServiceCollection services)
11 | {
12 | services.AddTransient();
13 |
14 | services.AddTransient ();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Utils/Modules/ServiceCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.DependencyInjection;
4 |
5 | namespace Shop.Utils.Modules
6 | {
7 | public static class ServiceCollectionExtensions
8 | {
9 | public static void RegisterModule(this IServiceCollection serviceCollection, IConfiguration configuration)
10 | where T : Module
11 | {
12 | var module = Activator.CreateInstance();
13 |
14 | module.Configuration = configuration;
15 |
16 | module.Load(serviceCollection);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/Shop.Order.DataAccess.MsSql.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/BackgroundJobsConfig/JobFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentScheduler;
3 | using Microsoft.Extensions.DependencyInjection;
4 |
5 | namespace Shop.Web.BackgroundJobsConfig
6 | {
7 | public class JobFactory : IJobFactory
8 | {
9 | private readonly IServiceProvider _serviceProvider;
10 |
11 | public JobFactory(IServiceProvider serviceProvider)
12 | {
13 | _serviceProvider = serviceProvider;
14 | }
15 |
16 | public IJob GetJobInstance() where T : IJob
17 | {
18 | var scope = _serviceProvider.CreateScope();
19 | var res = scope.ServiceProvider.GetService();
20 | return res;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Implementation/Shop.Framework.UseCases.Implementation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/Shop.Communication.DataAccess.MsSql.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Shop.Communication.UseCases.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/CommunicationDbContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Shop.Communication.DataAccess.Interfaces;
3 | using Shop.Communication.Entities;
4 |
5 | namespace Shop.Communication.DataAccess.MsSql
6 | {
7 | internal class CommunicationDbContext : DbContext, ICommunicationDbContext
8 | {
9 | public static string Schema = "Communication";
10 |
11 | public CommunicationDbContext(DbContextOptions options) : base(options)
12 | {
13 | }
14 |
15 | public DbSet Emails { get; set; }
16 |
17 | protected override void OnModelCreating(ModelBuilder modelBuilder)
18 | {
19 | modelBuilder.HasDefaultSchema(Schema);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:54450",
8 | "sslPort": 0
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "swagger",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "Shop.Web": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "swagger",
24 | "applicationUrl": "http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Contract.Implementation/CommunicationContract.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Microsoft.EntityFrameworkCore;
4 | using Shop.Communication.DataAccess.Interfaces;
5 |
6 | namespace Shop.Communication.Contract.Implementation
7 | {
8 | internal class CommunicationContract : ICommunicationContract
9 | {
10 | private readonly ICommunicationDbContext _communicationDbContext;
11 |
12 | public CommunicationContract(ICommunicationDbContext communicationDbContext)
13 | {
14 | _communicationDbContext = communicationDbContext;
15 | }
16 |
17 | public Task GetOrderEmailsCountAsync(int orderId, CancellationToken cancellationToken)
18 | {
19 | return _communicationDbContext.Emails.CountAsync(x => x.OrderId == orderId, cancellationToken);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Implementation/FrameworkModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc.Infrastructure;
2 | using Microsoft.Extensions.Configuration;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Shop.Framework.UseCases.Implementation.Services;
5 | using Shop.Framework.UseCases.Interfaces.Services;
6 | using Shop.Utils.Modules;
7 |
8 | namespace Shop.Framework.UseCases.Implementation
9 | {
10 | public class FrameworkModule : Module
11 | {
12 | public override void Load(IServiceCollection services)
13 | {
14 | services.AddScoped();
15 | services.AddScoped(factory => new ConnectionFactory(Configuration.GetConnectionString("MsSqlConnection")));
16 |
17 | services.AddSingleton();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Controllers/EmailrsController.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using MediatR;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Shop.Communication.UseCases.Emails.Dto;
6 | using Shop.Communication.UseCases.Emails.Queries.GetEmails;
7 |
8 | namespace Shop.Communication.Controllers
9 | {
10 | [Route("api/[controller]")]
11 | [ApiController]
12 | internal class EmailsController : ControllerBase
13 | {
14 | private readonly IMediator _mediator;
15 |
16 | public EmailsController(IMediator mediator)
17 | {
18 | _mediator = mediator;
19 | }
20 |
21 | // GET api/emails
22 | [HttpGet]
23 | public async Task> Get(CancellationToken token)
24 | {
25 | return await _mediator.Send(new GetEmailsRequest(), token);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Shop.Order.UseCases.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Implementation/Services/CurrentUserService.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Http;
2 | using Shop.Framework.UseCases.Interfaces.Services;
3 |
4 | namespace Shop.Framework.UseCases.Implementation.Services
5 | {
6 | internal class CurrentUserService : ICurrentUserService
7 | {
8 | public CurrentUserService(IHttpContextAccessor httpContextAccessor)
9 | {
10 | IsAuthenticated = httpContextAccessor.HttpContext?.User?.Identity?.IsAuthenticated == true;
11 | Id = 1;
12 | Email = "test@tets.com";
13 |
14 | //if (IsAuthenticated)
15 | //{
16 | // UserId = int.Parse(httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier));
17 | // Email = _httpContextAccessor.HttpContext.User.Identity.Name;
18 | //}
19 | }
20 |
21 | public int Id { get; }
22 | public bool IsAuthenticated { get; }
23 | public string Email { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Implementation/Shop.Communication.BackgroundJobs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Tests.Unit/Shop.Tests.Unit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | PreserveNewest
10 | true
11 | PreserveNewest
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | all
21 | runtime; build; native; contentfiles; analyzers; buildtransitive
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Emails/Queries/GetEmails/GetEmailsRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using AutoMapper;
4 | using AutoMapper.QueryableExtensions;
5 | using MediatR;
6 | using Microsoft.EntityFrameworkCore;
7 | using Shop.Communication.DataAccess.Interfaces;
8 | using Shop.Communication.UseCases.Emails.Dto;
9 |
10 | namespace Shop.Communication.UseCases.Emails.Queries.GetEmails
11 | {
12 | internal class GetEmailsRequestHandler : IRequestHandler
13 | {
14 | private readonly ICommunicationDbContext _dbContext;
15 | private readonly IMapper _mapper;
16 |
17 | public GetEmailsRequestHandler(ICommunicationDbContext dbContext, IMapper mapper)
18 | {
19 | _dbContext = dbContext;
20 | _mapper = mapper;
21 | }
22 |
23 | public Task Handle(GetEmailsRequest request, CancellationToken cancellationToken)
24 | {
25 | return _dbContext.Emails
26 | .ProjectTo(_mapper.ConfigurationProvider)
27 | .ToArrayAsync(cancellationToken);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ModularMonolith
2 | Run CreateDatabase.sql to create database structure before start application.
3 |
4 | The most important thing for Modular Monolith is data consistency for workflows which implemented using several modules. There are many ways to achieve data consistency:
5 | - Master branch used DbTransaction
6 | - CommitableTransaction branch based on master and used CommitableTransaction instead of DbTransaction ([diff](https://github.com/denis-tsv/ModularMonolith/pull/10/files))
7 | - TransactionScope-Connection branch based on master and used TransactionScope instead of DbTransaction for data consistency ([diff](https://github.com/denis-tsv/ModularMonolith/pull/11/files))
8 | - TransactionScope-ConnectionString branch based on TransactionScope-Connection and used connection string instead of connection for DbContect creation ([diff](https://github.com/denis-tsv/ModularMonolith/pull/12/files))
9 | - Compensation branch based on TransactionScope-ConnectionString and used compensation instead of transactions ([diff](https://github.com/denis-tsv/ModularMonolith/pull/13/files))
10 | - StateMachime branch based on Compensation and used state machine instead of compensation ([diff](https://github.com/denis-tsv/ModularMonolith/pull/15/files))
11 |
--------------------------------------------------------------------------------
/ModularMonolith/Infrastructure/Shop.Email.Implementation/EmailService.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using System.Net.Mail;
3 | using System.Threading.Tasks;
4 | using Microsoft.Extensions.Options;
5 | using Shop.Emails.Interfaces;
6 |
7 | namespace Shop.Emails.Implementation
8 | {
9 | internal class EmailService : IEmailService
10 | {
11 | private readonly EmailOptions _emailOptions;
12 | private readonly SmtpClient _client;
13 |
14 | public EmailService(IOptions emailOptions)
15 | {
16 | _emailOptions = emailOptions.Value;
17 |
18 | _client = new SmtpClient(_emailOptions.Server, _emailOptions.Port);
19 | _client.Credentials = new NetworkCredential(_emailOptions.Email, _emailOptions.Password);
20 | _client.EnableSsl = true;
21 | }
22 |
23 | public async Task SendEmailAsync(string email, string subject, string body)
24 | {
25 | var from = new MailAddress(_emailOptions.Email, _emailOptions.FromName);
26 | var to = new MailAddress(email);
27 | var message = new MailMessage(from, to);
28 | message.Subject = subject;
29 | message.Body = body;
30 |
31 | _client.Send(message);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.Controllers/OrdersController.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using MediatR;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Shop.Order.UseCases.Orders.Commands.CreateOrder;
6 | using Shop.Order.UseCases.Orders.Dto;
7 | using Shop.Order.UseCases.Orders.Queries.GetOrder;
8 |
9 | namespace Shop.Order.Controllers
10 | {
11 | [Route("api/[controller]")]
12 | [ApiController]
13 | internal class OrdersController : ControllerBase
14 | {
15 | private readonly IMediator _mediator;
16 |
17 | public OrdersController(IMediator mediator)
18 | {
19 | _mediator = mediator;
20 | }
21 |
22 | // GET api/orders/5
23 | [HttpGet("{id}")]
24 | public async Task> Get(int id, CancellationToken token)
25 | {
26 | return await _mediator.Send(new GetOrderRequest { Id = id }, token);
27 | }
28 |
29 | // POST api/orders
30 | [HttpPost]
31 | public async Task> Post([FromBody] CreateOrderDto createOrderDto, CancellationToken token)
32 | {
33 | return await _mediator.Send(new CreateOrderRequest { CreateOrderDto = createOrderDto }, token);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/OrderDataAccessModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Shop.Framework.UseCases.Interfaces.Services;
5 | using Shop.Order.DataAccess.Interfaces;
6 | using Shop.Utils.Modules;
7 |
8 | namespace Shop.Order.DataAccess.MsSql
9 | {
10 | public class OrderDataAccessModule : Module
11 | {
12 | public override void Load(IServiceCollection services)
13 | {
14 | services.AddDbContext((sp, bld) =>
15 | {
16 | var factory = sp.GetRequiredService();
17 | bld.UseSqlServer(factory.GetConnection(),
18 | opt => opt.MigrationsHistoryTable(HistoryRepository.DefaultTableName, OrderDbContext.Schema));
19 | });
20 |
21 | services.AddScoped(sp =>
22 | {
23 | var context = sp.GetRequiredService();
24 | var connectionFactory = sp.GetRequiredService();
25 |
26 | context.Database.UseTransaction(connectionFactory.GetTransaction());
27 |
28 | return context;
29 | });
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using FluentScheduler;
3 | using Microsoft.AspNetCore.Hosting;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Logging;
6 | using Shop.Web.BackgroundJobsConfig;
7 | using Microsoft.Extensions.Hosting;
8 |
9 | namespace Shop.Web
10 | {
11 | public class Program
12 | {
13 | public static void Main(string[] args)
14 | {
15 | var webHost = CreateWebHostBuilder(args).Build();
16 |
17 | JobManager.JobFactory = new JobFactory(webHost.Services);
18 | var regs = webHost.Services.GetServices();
19 | JobManager.Initialize(regs.ToArray());
20 | JobManager.JobException += info =>
21 | {
22 | var logger = webHost.Services.GetRequiredService>();
23 | logger.LogError(info.Exception, "Unhandled exception in job");
24 | };
25 |
26 | webHost.Run();
27 | }
28 |
29 | public static IHostBuilder CreateWebHostBuilder(string[] args) =>
30 | Host.CreateDefaultBuilder(args)
31 | .ConfigureWebHostDefaults(webBuilder =>
32 | {
33 | webBuilder.UseStartup();
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.Infrastructure.Implementation/BackgroundJobs/SendEmailsJob.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using FluentScheduler;
4 | using Shop.Communication.DataAccess.Interfaces;
5 | using Shop.Emails.Interfaces;
6 |
7 | namespace Shop.Communication.BackgroundJobs.BackgroundJobs
8 | {
9 | internal class SendEmailsJob : IJob
10 | {
11 | private readonly ICommunicationDbContext _dbContext;
12 | private readonly IEmailService _emailService;
13 |
14 | public SendEmailsJob(ICommunicationDbContext dbContext, IEmailService emailService)
15 | {
16 | _dbContext = dbContext;
17 | _emailService = emailService;
18 | }
19 |
20 | public void Execute()
21 | {
22 | foreach (var email in _dbContext.Emails.Where(x => !x.IsSended && x.Attempts < 3))
23 | {
24 | try
25 | {
26 | _emailService.SendEmailAsync(email.Address, email.Subject, email.Body).Wait();
27 |
28 | email.IsSended = true;
29 | }
30 | catch (Exception ex)
31 | {
32 | //logging
33 |
34 | email.Attempts++;
35 | }
36 | }
37 |
38 | _dbContext.SaveChanges();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.UseCases/Emails/NotificationHandlers/OrderCreatedNotificationHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using MediatR;
4 | using Shop.Communication.DataAccess.Interfaces;
5 | using Shop.Communication.Entities;
6 | using Shop.Order.Contract.Notifications;
7 |
8 | namespace Shop.Communication.UseCases.Emails.NotificationHandlers
9 | {
10 | internal class OrderCreatedNotificationHandler : INotificationHandler
11 | {
12 | private readonly ICommunicationDbContext _dbContext;
13 |
14 | public OrderCreatedNotificationHandler(ICommunicationDbContext dbContext)
15 | {
16 | _dbContext = dbContext;
17 | }
18 |
19 | public async Task Handle(OrderCreatedNotification notification, CancellationToken cancellationToken)
20 | {
21 | var mail = new Email
22 | {
23 | Address = notification.UserEmail,
24 | Subject = "Order created",
25 | Body = $"Your order {notification.OrderId} created successfully",
26 | OrderId = notification.OrderId,
27 | UserId = notification.UserId
28 | };
29 | _dbContext.Emails.Add(mail);
30 | await _dbContext.SaveChangesAsync(cancellationToken);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Utils/DbTransactionPipelineBehavior.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using MediatR;
4 | using Shop.Framework.UseCases.Interfaces.Services;
5 | using Shop.Framework.UseCases.Interfaces.Transactions;
6 |
7 | namespace Shop.Web.Utils
8 | {
9 | public class DbTransactionPipelineBehavior : IPipelineBehavior
10 | where TRequest : IRequest, ITransactionalRequest
11 | {
12 | private readonly IConnectionFactory _connectionFactory;
13 |
14 | public DbTransactionPipelineBehavior(IConnectionFactory connectionFactory)
15 | {
16 | _connectionFactory = connectionFactory;
17 | }
18 |
19 | public async Task Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken)
20 | {
21 | if (_connectionFactory.IsTransactionStarted)
22 | {
23 | return await next();
24 | }
25 |
26 | await using var connection = _connectionFactory.GetConnection();
27 | await using var transaction = _connectionFactory.GetTransaction();
28 |
29 | var result = await next();
30 |
31 | await transaction.CommitAsync(cancellationToken);
32 |
33 | return result;
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/CommunicationDataAccessModule.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Shop.Communication.DataAccess.Interfaces;
5 | using Shop.Framework.UseCases.Interfaces.Services;
6 | using Shop.Utils.Modules;
7 |
8 | namespace Shop.Communication.DataAccess.MsSql
9 | {
10 | public class CommunicationDataAccessModule : Module
11 | {
12 | public override void Load(IServiceCollection services)
13 | {
14 | services.AddDbContext((sp, bld) =>
15 | {
16 | var factory = sp.GetRequiredService();
17 | bld.UseSqlServer(factory.GetConnection(),
18 | opt => opt.MigrationsHistoryTable(HistoryRepository.DefaultTableName, CommunicationDbContext.Schema));
19 | });
20 |
21 | services.AddScoped(sp =>
22 | {
23 | var context = sp.GetRequiredService();
24 | var connectionFactory = sp.GetRequiredService();
25 |
26 | context.Database.UseTransaction(connectionFactory.GetTransaction());
27 |
28 | return context;
29 | });
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/ModularMonolith/Framework/Shop.Framework.Implementation/Services/ConnectionFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Data.Common;
2 | using Microsoft.Data.SqlClient;
3 | using Shop.Framework.UseCases.Interfaces.Services;
4 |
5 | namespace Shop.Framework.UseCases.Implementation.Services
6 | {
7 | internal class ConnectionFactory : IConnectionFactory
8 | {
9 | public ConnectionFactory(string connectionString)
10 | {
11 | _connectionString = connectionString;
12 | }
13 |
14 | private DbConnection _connection;
15 | private DbTransaction _transaction;
16 | private readonly string _connectionString;
17 |
18 | public DbConnection GetConnection()
19 | {
20 | if (_connection == null)
21 | {
22 | _connection = new SqlConnection(_connectionString);
23 | _connection.Open();
24 | }
25 | return _connection;
26 | }
27 |
28 | public DbTransaction GetTransaction()
29 | {
30 | return _transaction ??= GetConnection().BeginTransaction();
31 | }
32 |
33 | public bool IsConnectionOpened => _connection != null;
34 |
35 | public bool IsTransactionStarted => _transaction != null;
36 |
37 | public void Dispose()
38 | {
39 | _transaction?.Dispose();
40 | _connection?.Dispose();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/ModularMonolith/Tools/ModularMonolithAnalyzer/ModularMonolithAnalyzer.Vsix/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ModularMonolithAnalyzer
6 | This is a sample diagnostic extension for the .NET Compiler Platform ("Roslyn").
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/OrderDbContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Shop.Order.DataAccess.Interfaces;
3 | using Shop.Order.Entities;
4 |
5 | namespace Shop.Order.DataAccess.MsSql
6 | {
7 | internal class OrderDbContext : DbContext, IOrderDbContext
8 | {
9 | public const string Schema = "Order";
10 |
11 | public OrderDbContext(DbContextOptions options) : base(options)
12 | {
13 | }
14 |
15 | public DbSet Orders { get; set; }
16 |
17 | public DbSet OrderItems { get; set; }
18 |
19 | public DbSet Products { get; set; }
20 |
21 | protected override void OnModelCreating(ModelBuilder modelBuilder)
22 | {
23 | modelBuilder.HasDefaultSchema(Schema);
24 |
25 | DataSeed(modelBuilder);
26 | }
27 |
28 | private void DataSeed(ModelBuilder modelBuilder)
29 | {
30 | modelBuilder.Entity().HasData(
31 | new Product
32 | {
33 | Id = 1,
34 | Name = "First",
35 | Price = 10
36 | },
37 | new Product
38 | {
39 | Id = 2,
40 | Name = "Second",
41 | Price = 20
42 | },
43 | new Product
44 | {
45 | Id = 3,
46 | Name = "Third",
47 | Price = 10
48 | });
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Utils/ExceptionHandlerMiddleware.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using System.Threading.Tasks;
3 | using Microsoft.AspNetCore.Builder;
4 | using Microsoft.AspNetCore.Http;
5 | using Shop.Framework.UseCases.Interfaces.Exceptions;
6 |
7 | namespace Shop.Web.Utils
8 | {
9 | public class ExceptionHandlerMiddleware
10 | {
11 | private readonly RequestDelegate _next;
12 |
13 | public ExceptionHandlerMiddleware(RequestDelegate next)
14 | {
15 | _next = next;
16 | }
17 |
18 | public async Task Invoke(HttpContext httpContext)
19 | {
20 | try
21 | {
22 | await _next(httpContext);
23 | }
24 | catch (EntityNotFoundException e)//framework exception (common for all modules). also here can be used any exception from any module
25 | {
26 | await HandleException(httpContext, e.Message, HttpStatusCode.NotFound);
27 | }
28 | }
29 |
30 | private async Task HandleException(HttpContext httpContext, string message, HttpStatusCode code)
31 | {
32 | httpContext.Response.ContentType = "application/json";
33 | httpContext.Response.StatusCode = (int)code;
34 |
35 | await httpContext.Response.WriteAsync(message);
36 | }
37 | }
38 |
39 | // Extension method used to add the middleware to the HTTP request pipeline.
40 | public static class ExceptionHandlerMiddlewareExtensions
41 | {
42 | public static IApplicationBuilder UseExceptionHandlerMiddleware(this IApplicationBuilder builder)
43 | {
44 | return builder.UseMiddleware();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Queries/GetOrder/GetOrderRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using AutoMapper;
4 | using MediatR;
5 | using Microsoft.EntityFrameworkCore;
6 | using Shop.Communication.Contract;
7 | using Shop.Framework.UseCases.Interfaces.Exceptions;
8 | using Shop.Order.DataAccess.Interfaces;
9 | using Shop.Order.UseCases.Orders.Dto;
10 |
11 | namespace Shop.Order.UseCases.Orders.Queries.GetOrder
12 | {
13 | internal class GetOrderRequestHandler : IRequestHandler
14 | {
15 | private readonly IOrderDbContext _dbContext;
16 | private readonly IMapper _mapper;
17 | private readonly ICommunicationContract _communicationContract;
18 |
19 | public GetOrderRequestHandler(IOrderDbContext dbContext, IMapper mapper, ICommunicationContract communicationContract)
20 | {
21 | _dbContext = dbContext;
22 | _mapper = mapper;
23 | _communicationContract = communicationContract;
24 | }
25 |
26 | public async Task Handle(GetOrderRequest request, CancellationToken cancellationToken)
27 | {
28 | var order = await _dbContext.Orders.AsNoTracking()
29 | .Include(x => x.Items).ThenInclude(x => x.Product)
30 | .SingleOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
31 |
32 | if (order == null) throw new EntityNotFoundException();
33 |
34 | var result = _mapper.Map(order);
35 | result.Price = order.GetPrice();
36 | result.EmailsCount = await _communicationContract.GetOrderEmailsCountAsync(request.Id, cancellationToken);
37 |
38 | return result;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.UseCases/Orders/Commands/CreateOrder/CreateOrderRequestHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using AutoMapper;
5 | using MediatR;
6 | using Shop.Framework.UseCases.Interfaces.Services;
7 | using Shop.Order.Contract.Notifications;
8 | using Shop.Order.DataAccess.Interfaces;
9 |
10 | namespace Shop.Order.UseCases.Orders.Commands.CreateOrder
11 | {
12 | internal class CreateOrderRequestHandler : IRequestHandler
13 | {
14 | private readonly IOrderDbContext _dbContext;
15 | private readonly IMapper _mapper;
16 | private readonly ICurrentUserService _currentUserService;
17 | private readonly IPublisher _publisher;
18 |
19 | public CreateOrderRequestHandler(
20 | IOrderDbContext dbContext,
21 | IMapper mapper,
22 | ICurrentUserService currentUserService,
23 | IPublisher publisher)
24 | {
25 | _dbContext = dbContext;
26 | _mapper = mapper;
27 | _currentUserService = currentUserService;
28 | _publisher = publisher;
29 | }
30 |
31 | public async Task Handle(CreateOrderRequest request, CancellationToken cancellationToken)
32 | {
33 | var order = _mapper.Map(request.CreateOrderDto);
34 | order.CreationDate = DateTime.UtcNow;
35 | order.UserId = _currentUserService.Id;
36 |
37 | _dbContext.Orders.Add(order);
38 |
39 | await _dbContext.SaveChangesAsync(cancellationToken);
40 |
41 | await _publisher.Publish(new OrderCreatedNotification(order.Id, _currentUserService.Id, _currentUserService.Email), cancellationToken);
42 |
43 | return order.Id;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/ModularMonolith/Tools/ModularMonolithAnalyzer/ModularMonolithAnalyzer/tools/install.ps1:
--------------------------------------------------------------------------------
1 | param($installPath, $toolsPath, $package, $project)
2 |
3 | if($project.Object.SupportsPackageDependencyResolution)
4 | {
5 | if($project.Object.SupportsPackageDependencyResolution())
6 | {
7 | # Do not install analyzers via install.ps1, instead let the project system handle it.
8 | return
9 | }
10 | }
11 |
12 | $analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
13 |
14 | foreach($analyzersPath in $analyzersPaths)
15 | {
16 | if (Test-Path $analyzersPath)
17 | {
18 | # Install the language agnostic analyzers.
19 | foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
20 | {
21 | if($project.Object.AnalyzerReferences)
22 | {
23 | $project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
24 | }
25 | }
26 | }
27 | }
28 |
29 | # $project.Type gives the language name like (C# or VB.NET)
30 | $languageFolder = ""
31 | if($project.Type -eq "C#")
32 | {
33 | $languageFolder = "cs"
34 | }
35 | if($project.Type -eq "VB.NET")
36 | {
37 | $languageFolder = "vb"
38 | }
39 | if($languageFolder -eq "")
40 | {
41 | return
42 | }
43 |
44 | foreach($analyzersPath in $analyzersPaths)
45 | {
46 | # Install language specific analyzers.
47 | $languageAnalyzersPath = join-path $analyzersPath $languageFolder
48 | if (Test-Path $languageAnalyzersPath)
49 | {
50 | foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
51 | {
52 | if($project.Object.AnalyzerReferences)
53 | {
54 | $project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
55 | }
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/ModularMonolith/Tools/ModularMonolithAnalyzer/ModularMonolithAnalyzer/ModularMonolithAnalyzer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | false
6 | True
7 |
8 |
9 |
10 | ModularMonolithAnalyzer
11 | 1.0.0.0
12 | DenisT
13 | http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE
14 | http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE
15 | http://ICON_URL_HERE_OR_DELETE_THIS_LINE
16 | http://REPOSITORY_URL_HERE_OR_DELETE_THIS_LINE
17 | false
18 | ModularMonolithAnalyzer
19 | Summary of changes made in this release of the package.
20 | Copyright
21 | ModularMonolithAnalyzer, analyzers
22 | true
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/ModularMonolith/Tools/ModularMonolithAnalyzer/ModularMonolithAnalyzer/tools/uninstall.ps1:
--------------------------------------------------------------------------------
1 | param($installPath, $toolsPath, $package, $project)
2 |
3 | if($project.Object.SupportsPackageDependencyResolution)
4 | {
5 | if($project.Object.SupportsPackageDependencyResolution())
6 | {
7 | # Do not uninstall analyzers via uninstall.ps1, instead let the project system handle it.
8 | return
9 | }
10 | }
11 |
12 | $analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
13 |
14 | foreach($analyzersPath in $analyzersPaths)
15 | {
16 | # Uninstall the language agnostic analyzers.
17 | if (Test-Path $analyzersPath)
18 | {
19 | foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
20 | {
21 | if($project.Object.AnalyzerReferences)
22 | {
23 | $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
24 | }
25 | }
26 | }
27 | }
28 |
29 | # $project.Type gives the language name like (C# or VB.NET)
30 | $languageFolder = ""
31 | if($project.Type -eq "C#")
32 | {
33 | $languageFolder = "cs"
34 | }
35 | if($project.Type -eq "VB.NET")
36 | {
37 | $languageFolder = "vb"
38 | }
39 | if($languageFolder -eq "")
40 | {
41 | return
42 | }
43 |
44 | foreach($analyzersPath in $analyzersPaths)
45 | {
46 | # Uninstall language specific analyzers.
47 | $languageAnalyzersPath = join-path $analyzersPath $languageFolder
48 | if (Test-Path $languageAnalyzersPath)
49 | {
50 | foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
51 | {
52 | if($project.Object.AnalyzerReferences)
53 | {
54 | try
55 | {
56 | $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
57 | }
58 | catch
59 | {
60 |
61 | }
62 | }
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/Migrations/20200315150453_Communication_Initial.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Migrations;
2 |
3 | namespace Shop.Communication.DataAccess.MsSql.Migrations
4 | {
5 | public partial class Communication_Initial : Migration
6 | {
7 | protected override void Up(MigrationBuilder migrationBuilder)
8 | {
9 | migrationBuilder.EnsureSchema(
10 | name: "Communication");
11 |
12 | migrationBuilder.CreateTable(
13 | name: "Emails",
14 | schema: "Communication",
15 | columns: table => new
16 | {
17 | Id = table.Column(nullable: false)
18 | .Annotation("SqlServer:Identity", "1, 1"),
19 | Address = table.Column(nullable: true),
20 | Subject = table.Column(nullable: true),
21 | Body = table.Column(nullable: true),
22 | IsSended = table.Column(nullable: false),
23 | Attempts = table.Column(nullable: false),
24 | UserId = table.Column(nullable: false),
25 | OrderId = table.Column(nullable: false)
26 | },
27 | constraints: table =>
28 | {
29 | table.PrimaryKey("PK_Emails", x => x.Id);
30 | table.ForeignKey(
31 | name: "FK_Emails_Orders_OrderId",
32 | column: x => x.OrderId,
33 | principalTable: "Orders",
34 | principalColumn: "Id",
35 | principalSchema: "Order",
36 | onDelete: ReferentialAction.Cascade);
37 | });
38 |
39 | migrationBuilder.CreateIndex(
40 | name: "IX_Emails_OrderId",
41 | table: "Emails",
42 | column: "OrderId",
43 | schema: "Communication");
44 | }
45 |
46 | protected override void Down(MigrationBuilder migrationBuilder)
47 | {
48 | migrationBuilder.DropTable(
49 | name: "Emails",
50 | schema: "Communication");
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/Migrations/CommunicationDbContextModelSnapshot.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6 | using Shop.Communication.DataAccess.MsSql;
7 |
8 | namespace Shop.Communication.DataAccess.MsSql.Migrations
9 | {
10 | [DbContext(typeof(CommunicationDbContext))]
11 | partial class CommunicationDbContextModelSnapshot : ModelSnapshot
12 | {
13 | protected override void BuildModel(ModelBuilder modelBuilder)
14 | {
15 | #pragma warning disable 612, 618
16 | modelBuilder
17 | .HasDefaultSchema("Communication")
18 | .HasAnnotation("ProductVersion", "3.1.0")
19 | .HasAnnotation("Relational:MaxIdentifierLength", 128)
20 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
21 |
22 | modelBuilder.Entity("Shop.Communication.Entities.Email", b =>
23 | {
24 | b.Property("Id")
25 | .ValueGeneratedOnAdd()
26 | .HasColumnType("int")
27 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
28 |
29 | b.Property("Address")
30 | .HasColumnType("nvarchar(max)");
31 |
32 | b.Property("Attempts")
33 | .HasColumnType("int");
34 |
35 | b.Property("Body")
36 | .HasColumnType("nvarchar(max)");
37 |
38 | b.Property("IsSended")
39 | .HasColumnType("bit");
40 |
41 | b.Property("OrderId")
42 | .HasColumnType("int");
43 |
44 | b.Property("Subject")
45 | .HasColumnType("nvarchar(max)");
46 |
47 | b.Property("UserId")
48 | .HasColumnType("int");
49 |
50 | b.HasKey("Id");
51 |
52 | b.ToTable("Emails");
53 | });
54 | #pragma warning restore 612, 618
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ModularMonolith/Communication/Shop.Communication.DataAccess.MsSql/Migrations/20200315150453_Communication_Initial.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.EntityFrameworkCore;
3 | using Microsoft.EntityFrameworkCore.Infrastructure;
4 | using Microsoft.EntityFrameworkCore.Metadata;
5 | using Microsoft.EntityFrameworkCore.Migrations;
6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7 | using Shop.Communication.DataAccess.MsSql;
8 |
9 | namespace Shop.Communication.DataAccess.MsSql.Migrations
10 | {
11 | [DbContext(typeof(CommunicationDbContext))]
12 | [Migration("20200315150453_Communication_Initial")]
13 | partial class Communication_Initial
14 | {
15 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
16 | {
17 | #pragma warning disable 612, 618
18 | modelBuilder
19 | .HasDefaultSchema("Communication")
20 | .HasAnnotation("ProductVersion", "3.1.0")
21 | .HasAnnotation("Relational:MaxIdentifierLength", 128)
22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23 |
24 | modelBuilder.Entity("Shop.Communication.Entities.Email", b =>
25 | {
26 | b.Property("Id")
27 | .ValueGeneratedOnAdd()
28 | .HasColumnType("int")
29 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
30 |
31 | b.Property("Address")
32 | .HasColumnType("nvarchar(max)");
33 |
34 | b.Property("Attempts")
35 | .HasColumnType("int");
36 |
37 | b.Property("Body")
38 | .HasColumnType("nvarchar(max)");
39 |
40 | b.Property("IsSended")
41 | .HasColumnType("bit");
42 |
43 | b.Property("OrderId")
44 | .HasColumnType("int");
45 |
46 | b.Property("Subject")
47 | .HasColumnType("nvarchar(max)");
48 |
49 | b.Property("UserId")
50 | .HasColumnType("int");
51 |
52 | b.HasKey("Id");
53 |
54 | b.ToTable("Emails");
55 | });
56 | #pragma warning restore 612, 618
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Shop.Web.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TRACE
5 |
6 |
7 |
8 |
9 |
10 |
11 | all
12 | runtime; build; native; contentfiles; analyzers; buildtransitive
13 |
14 |
15 | all
16 | runtime; build; native; contentfiles; analyzers; buildtransitive
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Tests.Unit/ArchitectureTests.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Runtime.Loader;
6 | using Xunit;
7 |
8 | namespace Shop.Tests.Unit
9 | {
10 | public class ArchitectureTests
11 | {
12 | [Fact]
13 | public void CrossLayerReferences()
14 | {
15 | var wrongReferences = new List<(string From, string To)>
16 | {
17 | ("UseCases", "DataAccess.MsSql"),
18 | ("UseCases", "Infrastructure.Implementation"),
19 | ("UseCases", "DomainServices.Implementation"),
20 |
21 | ("Controllers", "DataAccess"),
22 | ("Controllers", "Infrastructure.Interfaces"),
23 | ("Controllers", "DomainServices.Interfaces"),
24 | ("Controllers", "Infrastructure.Implementation"),
25 | ("Controllers", "DomainServices.Implementation"),
26 |
27 | ("Infrastructure.Implementation", "DomainServices.Implementation"),
28 | };
29 |
30 | var location = Assembly.GetExecutingAssembly().Location;
31 | var assemblies = Directory.EnumerateFiles(Path.GetDirectoryName(location), "Shop*.dll")
32 | .Select(AssemblyLoadContext.Default.LoadFromAssemblyPath)
33 | .ToList();
34 |
35 | foreach (var layer in wrongReferences)
36 | {
37 | foreach (var assembly in assemblies)
38 | {
39 | foreach (var reference in assembly.GetReferencedAssemblies())
40 | {
41 | Assert.False(assembly.FullName.Contains(layer.From) && reference.FullName.Contains(layer.To),
42 | $"Cross-layer reference from '{assembly.FullName}' to '{reference.FullName}'");
43 | }
44 | }
45 | }
46 | }
47 |
48 | [Fact]
49 | public void CrossModuleReferences()
50 | {
51 | var modules = new List
52 | {
53 | "Communication", "Order"
54 | };
55 |
56 | var location = Assembly.GetExecutingAssembly().Location;
57 | var assemblies = Directory.EnumerateFiles(Path.GetDirectoryName(location), "Shop*.dll")
58 | .Select(AssemblyLoadContext.Default.LoadFromAssemblyPath)
59 | .ToList();
60 |
61 | foreach (var fromModule in modules)
62 | {
63 | foreach (var toModule in modules)
64 | {
65 | if (fromModule == toModule) continue;
66 |
67 | foreach (var assembly in assemblies)
68 | {
69 | foreach (var reference in assembly.GetReferencedAssemblies())
70 | {
71 | //not only reference, but real usage of class from other assembly
72 | Assert.False(assembly.FullName.Contains(fromModule) &&
73 | reference.FullName.Contains(toModule) &&
74 | !reference.FullName.Contains("Contract"),
75 | $"Cross-context reference from '{assembly.FullName}' to '{reference.FullName}'");
76 | }
77 | }
78 | }
79 | }
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/ModularMonolith/Tools/ModularMonolithAnalyzer/ModularMonolithAnalyzer/ModularMonolithAnalyzerAnalyzer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.Immutable;
3 | using Microsoft.CodeAnalysis;
4 | using Microsoft.CodeAnalysis.CSharp;
5 | using Microsoft.CodeAnalysis.CSharp.Syntax;
6 | using Microsoft.CodeAnalysis.Diagnostics;
7 |
8 | namespace ModularMonolithAnalyzer
9 | {
10 | [DiagnosticAnalyzer(LanguageNames.CSharp)]
11 | public class ModularMonolithAnalyzerAnalyzer : DiagnosticAnalyzer
12 | {
13 | private readonly List<(string From, string To)> _wrongReferences = new List<(string, string)>
14 | {
15 | ( "UseCases", "DataAccess"),
16 | ( "UseCases", "Infrastructure.Implementation"),
17 | ( "UseCases", "DomainServices.Implementation"),
18 |
19 | ("Controllers", "DataAccess"),
20 | ("Controllers", "Infrastructure.Interfaces"),
21 | ("Controllers", "DomainServices.Interfaces"),
22 | ("Controllers", "Infrastructure.Implementation"),
23 | ("Controllers", "DomainServices.Implementation"),
24 |
25 | ("Infrastructure.Implementation", "DomainServices.Implementation"),
26 |
27 | };
28 |
29 | private readonly List _modules = new List
30 | {
31 | "Communication", "Order"
32 | };
33 |
34 | private const string Category = "InvalidReference";
35 |
36 | private static readonly DiagnosticDescriptor CrossLevelReference = new DiagnosticDescriptor("CrosLvl", "Cross-level reference", "Cross-level reference", Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: "Cross-level reference");
37 | private static readonly DiagnosticDescriptor CrossModuleReference = new DiagnosticDescriptor("CrosModule", "Cross-module reference", "Cross-module reference", Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: "Cross-module reference");
38 |
39 | public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(CrossLevelReference, CrossModuleReference);
40 |
41 | public override void Initialize(AnalysisContext context)
42 | {
43 | context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.UsingDirective);
44 | }
45 |
46 | private void AnalyzeNode(SyntaxNodeAnalysisContext context)
47 | {
48 | var namespaceName = ((UsingDirectiveSyntax)context.Node).Name.ToString();
49 | var assemblyName = context.Compilation.AssemblyName;
50 |
51 | foreach (var layer in _wrongReferences)
52 | {
53 | if (assemblyName.Contains(layer.From) && namespaceName.Contains(layer.To))
54 | {
55 | context.ReportDiagnostic(Diagnostic.Create(CrossLevelReference, context.Node.GetLocation()));
56 | }
57 | }
58 |
59 | for (int i = 0; i < _modules.Count; i++)
60 | {
61 | for (int j = 0; j < _modules.Count; j++)
62 | {
63 | if (i == j) continue;
64 |
65 | if (assemblyName.Contains(_modules[i]) && namespaceName.Contains(_modules[j]) && !namespaceName.Contains("Contract"))
66 | {
67 | context.ReportDiagnostic(Diagnostic.Create(CrossModuleReference, context.Node.GetLocation()));
68 | }
69 | }
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/ModularMonolith/Tools/ModularMonolithAnalyzer/ModularMonolithAnalyzer.Vsix/ModularMonolithAnalyzer.Vsix.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 15.0
6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
7 |
8 |
9 | 14.0
10 |
11 |
12 |
13 |
14 |
15 | Debug
16 | AnyCPU
17 | AnyCPU
18 | 2.0
19 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
20 | {BEDF4E64-8F5E-4E43-B030-957EABCE745E}
21 | Library
22 | Properties
23 | ModularMonolithAnalyzer.Vsix
24 | ModularMonolithAnalyzer
25 | v4.7.2
26 | false
27 | false
28 | false
29 | false
30 | false
31 | false
32 | Roslyn
33 |
34 |
35 | true
36 | full
37 | false
38 | bin\Debug\
39 | DEBUG;TRACE
40 | prompt
41 | 4
42 |
43 |
44 | pdbonly
45 | true
46 | bin\Release\
47 | TRACE
48 | prompt
49 | 4
50 |
51 |
52 | Program
53 | $(DevEnvDir)devenv.exe
54 | /rootsuffix Roslyn
55 |
56 |
57 |
58 | Designer
59 |
60 |
61 |
62 |
63 | {7DBECBA8-5481-483E-B5F0-D573A819ADC8}
64 | ModularMonolithAnalyzer
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Web/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Linq;
3 | using System.Reflection;
4 | using System.Runtime.Loader;
5 | using MediatR;
6 | using Microsoft.AspNetCore.Builder;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using Shop.Order.DataAccess.MsSql;
11 | using Shop.Order.UseCases;
12 | using Shop.Web.Utils;
13 | using Microsoft.Extensions.Hosting;
14 | using Shop.Communication.BackgroundJobs;
15 | using Shop.Communication.Contract.Implementation;
16 | using Shop.Communication.DataAccess.MsSql;
17 | using Shop.Order.Contract.Implementation;
18 | using Shop.Communication.UseCases;
19 | using Shop.Emails.Implementation;
20 | using Shop.Framework.UseCases.Implementation;
21 | using Shop.Utils.Modules;
22 | using Microsoft.AspNetCore.Routing;
23 |
24 | namespace Shop.Web
25 | {
26 | public class Startup
27 | {
28 | public Startup(IConfiguration configuration)
29 | {
30 | Configuration = configuration;
31 | }
32 |
33 | public IConfiguration Configuration { get; }
34 |
35 | public void ConfigureServices(IServiceCollection services)
36 | {
37 | services.AddHttpContextAccessor();
38 |
39 | services.AddOptions();
40 |
41 | services.AddControllers()
42 | .ConfigureApplicationPartManager(manager => manager.FeatureProviders.Add(new InternalControllerFeatureProvider()));
43 |
44 | services.RegisterModule(Configuration);
45 | services.RegisterModule(Configuration);
46 |
47 | services.RegisterModule(Configuration);
48 | services.RegisterModule(Configuration);
49 |
50 | services.RegisterModule(Configuration);
51 | services.RegisterModule(Configuration);
52 | services.RegisterModule(Configuration);
53 |
54 | services.RegisterModule(Configuration);
55 | services.RegisterModule(Configuration);
56 |
57 | services.AddScoped(typeof(IPipelineBehavior<,>), typeof(DbTransactionPipelineBehavior<,>));
58 |
59 | var location = Assembly.GetExecutingAssembly().Location;
60 | var assemblies = Directory.EnumerateFiles(Path.GetDirectoryName(location)!, "Shop*UseCases.dll")
61 | .Select(AssemblyLoadContext.Default.LoadFromAssemblyPath)
62 | .ToArray();
63 |
64 | services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(assemblies));
65 |
66 | services.AddAutoMapper(assemblies);
67 |
68 | services.AddEndpointsApiExplorer();
69 | services.AddSwaggerGen();
70 |
71 | services.Configure(options =>
72 | {
73 | options.LowercaseUrls = true;
74 | options.LowercaseQueryStrings = true;
75 | });
76 | }
77 |
78 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
79 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
80 | {
81 | if (env.IsDevelopment())
82 | {
83 | app.UseDeveloperExceptionPage();
84 |
85 | app.UseSwagger();
86 | app.UseSwaggerUI();
87 | }
88 |
89 | app.UseExceptionHandlerMiddleware();
90 |
91 | app.UseRouting();
92 |
93 | app.UseAuthorization();
94 |
95 | app.UseEndpoints(endpoints =>
96 | {
97 | endpoints.MapControllers();
98 | });
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/ModularMonolith/CreateDatabase.sql:
--------------------------------------------------------------------------------
1 | USE [master]
2 | GO
3 |
4 | /****** Object: Database [ModularMonolith] Script Date: 3/31/2022 5:50:32 PM ******/
5 | CREATE DATABASE [ModularMonolith2]
6 | GO
7 |
8 | USE [ModularMonolith2]
9 | GO
10 | /****** Object: Schema [Communication] Script Date: 3/31/2022 4:57:05 PM ******/
11 | CREATE SCHEMA [Communication]
12 | GO
13 | /****** Object: Schema [Order] Script Date: 3/31/2022 4:57:05 PM ******/
14 | CREATE SCHEMA [Order]
15 | GO
16 | /****** Object: Table [Communication].[Emails] Script Date: 3/31/2022 4:57:05 PM ******/
17 | SET ANSI_NULLS ON
18 | GO
19 | SET QUOTED_IDENTIFIER ON
20 | GO
21 | CREATE TABLE [Communication].[Emails](
22 | [Id] [int] IDENTITY(1,1) NOT NULL,
23 | [Address] [nvarchar](max) NULL,
24 | [Subject] [nvarchar](max) NULL,
25 | [Body] [nvarchar](max) NULL,
26 | [IsSended] [bit] NOT NULL,
27 | [Attempts] [int] NOT NULL,
28 | [UserId] [int] NOT NULL,
29 | [OrderId] [int] NOT NULL,
30 | CONSTRAINT [PK_Emails] PRIMARY KEY CLUSTERED
31 | (
32 | [Id] ASC
33 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
34 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
35 | GO
36 | /****** Object: Table [Order].[OrderItems] Script Date: 3/31/2022 4:57:05 PM ******/
37 | SET ANSI_NULLS ON
38 | GO
39 | SET QUOTED_IDENTIFIER ON
40 | GO
41 | CREATE TABLE [Order].[OrderItems](
42 | [Id] [int] IDENTITY(1,1) NOT NULL,
43 | [OrderId] [int] NOT NULL,
44 | [ProductId] [int] NOT NULL,
45 | [Count] [int] NOT NULL,
46 | CONSTRAINT [PK_OrderItems] PRIMARY KEY CLUSTERED
47 | (
48 | [Id] ASC
49 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
50 | ) ON [PRIMARY]
51 | GO
52 | /****** Object: Table [Order].[Orders] Script Date: 3/31/2022 4:57:05 PM ******/
53 | SET ANSI_NULLS ON
54 | GO
55 | SET QUOTED_IDENTIFIER ON
56 | GO
57 | CREATE TABLE [Order].[Orders](
58 | [Id] [int] IDENTITY(1,1) NOT NULL,
59 | [CreationDate] [datetime2](7) NOT NULL,
60 | [UserId] [int] NOT NULL,
61 | CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED
62 | (
63 | [Id] ASC
64 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
65 | ) ON [PRIMARY]
66 | GO
67 | /****** Object: Table [Order].[Products] Script Date: 3/31/2022 4:57:05 PM ******/
68 | SET ANSI_NULLS ON
69 | GO
70 | SET QUOTED_IDENTIFIER ON
71 | GO
72 | CREATE TABLE [Order].[Products](
73 | [Id] [int] IDENTITY(1,1) NOT NULL,
74 | [Name] [nvarchar](max) NULL,
75 | [Price] [decimal](18, 2) NOT NULL,
76 | CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED
77 | (
78 | [Id] ASC
79 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
80 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
81 | GO
82 | ALTER TABLE [Communication].[Emails] WITH CHECK ADD CONSTRAINT [FK_Emails_Orders_OrderId] FOREIGN KEY([OrderId])
83 | REFERENCES [Order].[Orders] ([Id])
84 | ON DELETE CASCADE
85 | GO
86 | ALTER TABLE [Communication].[Emails] CHECK CONSTRAINT [FK_Emails_Orders_OrderId]
87 | GO
88 | ALTER TABLE [Order].[OrderItems] WITH CHECK ADD CONSTRAINT [FK_OrderItems_Orders_OrderId] FOREIGN KEY([OrderId])
89 | REFERENCES [Order].[Orders] ([Id])
90 | ON DELETE CASCADE
91 | GO
92 | ALTER TABLE [Order].[OrderItems] CHECK CONSTRAINT [FK_OrderItems_Orders_OrderId]
93 | GO
94 | ALTER TABLE [Order].[OrderItems] WITH CHECK ADD CONSTRAINT [FK_OrderItems_Products_ProductId] FOREIGN KEY([ProductId])
95 | REFERENCES [Order].[Products] ([Id])
96 | ON DELETE CASCADE
97 | GO
98 | ALTER TABLE [Order].[OrderItems] CHECK CONSTRAINT [FK_OrderItems_Products_ProductId]
99 | GO
100 |
101 | INSERT INTO [Order].[Products] ([Name],[Price]) VALUES('Product 1', 1)
102 | INSERT INTO [Order].[Products] ([Name],[Price]) VALUES('Product 2', 10)
103 | GO
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/Migrations/OrderDbContextModelSnapshot.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using Microsoft.EntityFrameworkCore;
4 | using Microsoft.EntityFrameworkCore.Infrastructure;
5 | using Microsoft.EntityFrameworkCore.Metadata;
6 |
7 | namespace Shop.Order.DataAccess.MsSql.Migrations
8 | {
9 | [DbContext(typeof(OrderDbContext))]
10 | partial class OrderDbContextModelSnapshot : ModelSnapshot
11 | {
12 | protected override void BuildModel(ModelBuilder modelBuilder)
13 | {
14 | #pragma warning disable 612, 618
15 | modelBuilder
16 | .HasDefaultSchema("Order")
17 | .HasAnnotation("ProductVersion", "3.1.0")
18 | .HasAnnotation("Relational:MaxIdentifierLength", 128)
19 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
20 |
21 | modelBuilder.Entity("Shop.Order.Entities.Order", b =>
22 | {
23 | b.Property("Id")
24 | .ValueGeneratedOnAdd()
25 | .HasColumnType("int")
26 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
27 |
28 | b.Property("CreationDate")
29 | .HasColumnType("datetime2");
30 |
31 | b.Property("UserId")
32 | .HasColumnType("int");
33 |
34 | b.HasKey("Id");
35 |
36 | b.ToTable("Orders");
37 | });
38 |
39 | modelBuilder.Entity("Shop.Order.Entities.OrderItem", b =>
40 | {
41 | b.Property("Id")
42 | .ValueGeneratedOnAdd()
43 | .HasColumnType("int")
44 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
45 |
46 | b.Property("Count")
47 | .HasColumnType("int");
48 |
49 | b.Property("OrderId")
50 | .HasColumnType("int");
51 |
52 | b.Property("ProductId")
53 | .HasColumnType("int");
54 |
55 | b.HasKey("Id");
56 |
57 | b.HasIndex("OrderId");
58 |
59 | b.HasIndex("ProductId");
60 |
61 | b.ToTable("OrderItems");
62 | });
63 |
64 | modelBuilder.Entity("Shop.Order.Entities.Product", b =>
65 | {
66 | b.Property("Id")
67 | .ValueGeneratedOnAdd()
68 | .HasColumnType("int")
69 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
70 |
71 | b.Property("Name")
72 | .HasColumnType("nvarchar(max)");
73 |
74 | b.Property("Price")
75 | .HasColumnType("decimal(18,2)");
76 |
77 | b.HasKey("Id");
78 |
79 | b.ToTable("Products");
80 |
81 | b.HasData(
82 | new
83 | {
84 | Id = 1,
85 | Name = "First",
86 | Price = 10m
87 | },
88 | new
89 | {
90 | Id = 2,
91 | Name = "Second",
92 | Price = 20m
93 | },
94 | new
95 | {
96 | Id = 3,
97 | Name = "Third",
98 | Price = 10m
99 | });
100 | });
101 |
102 | modelBuilder.Entity("Shop.Order.Entities.OrderItem", b =>
103 | {
104 | b.HasOne("Shop.Order.Entities.Order", "Order")
105 | .WithMany("Items")
106 | .HasForeignKey("OrderId")
107 | .OnDelete(DeleteBehavior.Cascade)
108 | .IsRequired();
109 |
110 | b.HasOne("Shop.Order.Entities.Product", "Product")
111 | .WithMany()
112 | .HasForeignKey("ProductId")
113 | .OnDelete(DeleteBehavior.Cascade)
114 | .IsRequired();
115 | });
116 | #pragma warning restore 612, 618
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/Migrations/20200315150200_Order_Initial.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.EntityFrameworkCore.Migrations;
3 |
4 | namespace Shop.Order.DataAccess.MsSql.Migrations
5 | {
6 | public partial class Order_Initial : Migration
7 | {
8 | protected override void Up(MigrationBuilder migrationBuilder)
9 | {
10 | migrationBuilder.EnsureSchema(
11 | name: "Order");
12 |
13 | migrationBuilder.CreateTable(
14 | name: "Orders",
15 | schema: "Order",
16 | columns: table => new
17 | {
18 | Id = table.Column(nullable: false)
19 | .Annotation("SqlServer:Identity", "1, 1"),
20 | CreationDate = table.Column(nullable: false),
21 | UserId = table.Column(nullable: false)
22 | },
23 | constraints: table =>
24 | {
25 | table.PrimaryKey("PK_Orders", x => x.Id);
26 | });
27 |
28 | migrationBuilder.CreateTable(
29 | name: "Products",
30 | schema: "Order",
31 | columns: table => new
32 | {
33 | Id = table.Column(nullable: false)
34 | .Annotation("SqlServer:Identity", "1, 1"),
35 | Name = table.Column(nullable: true),
36 | Price = table.Column(nullable: false)
37 | },
38 | constraints: table =>
39 | {
40 | table.PrimaryKey("PK_Products", x => x.Id);
41 | });
42 |
43 | migrationBuilder.CreateTable(
44 | name: "OrderItems",
45 | schema: "Order",
46 | columns: table => new
47 | {
48 | Id = table.Column(nullable: false)
49 | .Annotation("SqlServer:Identity", "1, 1"),
50 | OrderId = table.Column(nullable: false),
51 | ProductId = table.Column(nullable: false),
52 | Count = table.Column(nullable: false)
53 | },
54 | constraints: table =>
55 | {
56 | table.PrimaryKey("PK_OrderItems", x => x.Id);
57 | table.ForeignKey(
58 | name: "FK_OrderItems_Orders_OrderId",
59 | column: x => x.OrderId,
60 | principalSchema: "Order",
61 | principalTable: "Orders",
62 | principalColumn: "Id",
63 | onDelete: ReferentialAction.Cascade);
64 | table.ForeignKey(
65 | name: "FK_OrderItems_Products_ProductId",
66 | column: x => x.ProductId,
67 | principalSchema: "Order",
68 | principalTable: "Products",
69 | principalColumn: "Id",
70 | onDelete: ReferentialAction.Cascade);
71 | });
72 |
73 | migrationBuilder.InsertData(
74 | schema: "Order",
75 | table: "Products",
76 | columns: new[] { "Id", "Name", "Price" },
77 | values: new object[] { 1, "First", 10m });
78 |
79 | migrationBuilder.InsertData(
80 | schema: "Order",
81 | table: "Products",
82 | columns: new[] { "Id", "Name", "Price" },
83 | values: new object[] { 2, "Second", 20m });
84 |
85 | migrationBuilder.InsertData(
86 | schema: "Order",
87 | table: "Products",
88 | columns: new[] { "Id", "Name", "Price" },
89 | values: new object[] { 3, "Third", 10m });
90 |
91 | migrationBuilder.CreateIndex(
92 | name: "IX_OrderItems_OrderId",
93 | schema: "Order",
94 | table: "OrderItems",
95 | column: "OrderId");
96 |
97 | migrationBuilder.CreateIndex(
98 | name: "IX_OrderItems_ProductId",
99 | schema: "Order",
100 | table: "OrderItems",
101 | column: "ProductId");
102 | }
103 |
104 | protected override void Down(MigrationBuilder migrationBuilder)
105 | {
106 | migrationBuilder.DropTable(
107 | name: "OrderItems",
108 | schema: "Order");
109 |
110 | migrationBuilder.DropTable(
111 | name: "Orders",
112 | schema: "Order");
113 |
114 | migrationBuilder.DropTable(
115 | name: "Products",
116 | schema: "Order");
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/ModularMonolith/Order/Shop.Order.DataAccess.MsSql/Migrations/20200315150200_Order_Initial.Designer.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using Microsoft.EntityFrameworkCore;
4 | using Microsoft.EntityFrameworkCore.Infrastructure;
5 | using Microsoft.EntityFrameworkCore.Metadata;
6 | using Microsoft.EntityFrameworkCore.Migrations;
7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8 | using Shop.Order.DataAccess.MsSql;
9 |
10 | namespace Shop.Order.DataAccess.MsSql.Migrations
11 | {
12 | [DbContext(typeof(OrderDbContext))]
13 | [Migration("20200315150200_Order_Initial")]
14 | partial class Order_Initial
15 | {
16 | protected override void BuildTargetModel(ModelBuilder modelBuilder)
17 | {
18 | #pragma warning disable 612, 618
19 | modelBuilder
20 | .HasDefaultSchema("Order")
21 | .HasAnnotation("ProductVersion", "3.1.0")
22 | .HasAnnotation("Relational:MaxIdentifierLength", 128)
23 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
24 |
25 | modelBuilder.Entity("Shop.Order.Entities.Order", b =>
26 | {
27 | b.Property("Id")
28 | .ValueGeneratedOnAdd()
29 | .HasColumnType("int")
30 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
31 |
32 | b.Property("CreationDate")
33 | .HasColumnType("datetime2");
34 |
35 | b.Property("UserId")
36 | .HasColumnType("int");
37 |
38 | b.HasKey("Id");
39 |
40 | b.ToTable("Orders");
41 | });
42 |
43 | modelBuilder.Entity("Shop.Order.Entities.OrderItem", b =>
44 | {
45 | b.Property("Id")
46 | .ValueGeneratedOnAdd()
47 | .HasColumnType("int")
48 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
49 |
50 | b.Property("Count")
51 | .HasColumnType("int");
52 |
53 | b.Property("OrderId")
54 | .HasColumnType("int");
55 |
56 | b.Property("ProductId")
57 | .HasColumnType("int");
58 |
59 | b.HasKey("Id");
60 |
61 | b.HasIndex("OrderId");
62 |
63 | b.HasIndex("ProductId");
64 |
65 | b.ToTable("OrderItems");
66 | });
67 |
68 | modelBuilder.Entity("Shop.Order.Entities.Product", b =>
69 | {
70 | b.Property("Id")
71 | .ValueGeneratedOnAdd()
72 | .HasColumnType("int")
73 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
74 |
75 | b.Property("Name")
76 | .HasColumnType("nvarchar(max)");
77 |
78 | b.Property("Price")
79 | .HasColumnType("decimal(18,2)");
80 |
81 | b.HasKey("Id");
82 |
83 | b.ToTable("Products");
84 |
85 | b.HasData(
86 | new
87 | {
88 | Id = 1,
89 | Name = "First",
90 | Price = 10m
91 | },
92 | new
93 | {
94 | Id = 2,
95 | Name = "Second",
96 | Price = 20m
97 | },
98 | new
99 | {
100 | Id = 3,
101 | Name = "Third",
102 | Price = 10m
103 | });
104 | });
105 |
106 | modelBuilder.Entity("Shop.Order.Entities.OrderItem", b =>
107 | {
108 | b.HasOne("Shop.Order.Entities.Order", "Order")
109 | .WithMany("Items")
110 | .HasForeignKey("OrderId")
111 | .OnDelete(DeleteBehavior.Cascade)
112 | .IsRequired();
113 |
114 | b.HasOne("Shop.Order.Entities.Product", "Product")
115 | .WithMany()
116 | .HasForeignKey("ProductId")
117 | .OnDelete(DeleteBehavior.Cascade)
118 | .IsRequired();
119 | });
120 | #pragma warning restore 612, 618
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Tests.Unit/WorkflowTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Runtime.Loader;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using MediatR;
9 | using Microsoft.EntityFrameworkCore;
10 | using Microsoft.Extensions.Configuration;
11 | using Microsoft.Extensions.DependencyInjection;
12 | using Shop.Communication.BackgroundJobs;
13 | using Shop.Communication.Contract.Implementation;
14 | using Shop.Communication.DataAccess.Interfaces;
15 | using Shop.Communication.DataAccess.MsSql;
16 | using Shop.Communication.Entities;
17 | using Shop.Communication.UseCases;
18 | using Shop.Emails.Implementation;
19 | using Shop.Framework.UseCases.Implementation;
20 | using Shop.Order.Contract.Implementation;
21 | using Shop.Order.DataAccess.MsSql;
22 | using Shop.Order.UseCases;
23 | using Shop.Order.UseCases.Orders.Commands.CreateOrder;
24 | using Shop.Order.UseCases.Orders.Dto;
25 | using Shop.Utils.Modules;
26 | using Shop.Web.Utils;
27 | using Xunit;
28 |
29 | namespace Shop.Tests.Unit
30 | {
31 | public class WorkflowTests
32 | {
33 | [Fact]
34 | public async Task Should_Create_Order_And_Email()
35 | {
36 | //arrange
37 | var (connectionString, configuration) = CreateConfiguration();
38 |
39 | var services = CreateServiceProvider(configuration);
40 |
41 | var serviceProvider = services.BuildServiceProvider();
42 |
43 | var (orderDbContext, communicationDbContext) = await CreateDatabase(connectionString);
44 |
45 | var sender = serviceProvider.GetRequiredService();
46 | var dto = new CreateOrderDto { Items = new[] { new OrderItemDto { Count = 1, ProductId = 1 } } };
47 |
48 | //act
49 | var orderId = await sender.Send(new CreateOrderRequest { CreateOrderDto = dto });
50 |
51 | //assert
52 | var order = await orderDbContext.Orders.FirstOrDefaultAsync(x => x.Id == orderId);
53 | var email = await communicationDbContext.Emails.FirstOrDefaultAsync(x => x.OrderId == orderId);
54 |
55 | Assert.NotNull(order);
56 | Assert.NotNull(email);
57 |
58 | await orderDbContext.Database.EnsureDeletedAsync();
59 | }
60 |
61 | [Fact]
62 | public async Task Should_Not_Create_Order_And_Email_On_Error()
63 | {
64 | //arrange
65 | var (connectionString, configuration) = CreateConfiguration();
66 |
67 | var services = CreateServiceProvider(configuration);
68 | services.Decorate();
69 |
70 | var serviceProvider = services.BuildServiceProvider();
71 |
72 | var (orderDbContext, communicationDbContext) = await CreateDatabase(connectionString);
73 |
74 | var sender = serviceProvider.GetRequiredService();
75 | var dto = new CreateOrderDto { Items = new[] { new OrderItemDto { Count = 1, ProductId = 1 } } };
76 |
77 | //act
78 | await Assert.ThrowsAsync(() => sender.Send(new CreateOrderRequest { CreateOrderDto = dto }));
79 |
80 | //assert
81 | var ordersCount = await orderDbContext.Orders.CountAsync();
82 | var emailsCount = await communicationDbContext.Emails.CountAsync();
83 |
84 | Assert.Equal(0, ordersCount);
85 | Assert.Equal(0, emailsCount);
86 |
87 | await orderDbContext.Database.EnsureDeletedAsync();
88 | }
89 |
90 | class TestCommunicationDbContext : ICommunicationDbContext
91 | {
92 | private readonly ICommunicationDbContext _context;
93 |
94 | public TestCommunicationDbContext(ICommunicationDbContext context)
95 | {
96 | _context = context;
97 | }
98 |
99 | public DbSet Emails
100 | {
101 | get => _context.Emails;
102 | set => _context.Emails = value;
103 | }
104 |
105 | public int SaveChanges()
106 | {
107 | throw new Exception("Fail");
108 | }
109 |
110 | public Task SaveChangesAsync(CancellationToken token = default)
111 | {
112 | throw new Exception("Fail");
113 | }
114 | }
115 |
116 | private (string, IConfigurationRoot) CreateConfiguration()
117 | {
118 | var configuration = new ConfigurationBuilder()
119 | .AddJsonFile("appsettings.json")
120 | .Build();
121 | var connectionString = $"Data Source=.;Initial Catalog=Test_{Guid.NewGuid()};Integrated Security=True";
122 | configuration.GetSection("ConnectionStrings")["MsSqlConnection"] = connectionString;
123 |
124 | return (connectionString, configuration);
125 | }
126 |
127 | private ServiceCollection CreateServiceProvider(IConfiguration configuration)
128 | {
129 | var location = Assembly.GetExecutingAssembly().Location;
130 | var assemblies = Directory.EnumerateFiles(Path.GetDirectoryName(location)!, "Shop*UseCases.dll")
131 | .Select(AssemblyLoadContext.Default.LoadFromAssemblyPath)
132 | .ToArray();
133 |
134 | var services = new ServiceCollection();
135 |
136 | services.AddHttpContextAccessor();
137 |
138 | services.AddOptions();
139 |
140 | services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(assemblies));
141 | services.AddAutoMapper(assemblies);
142 |
143 | services.AddScoped(typeof(IPipelineBehavior<,>), typeof(DbTransactionPipelineBehavior<,>));
144 |
145 | services.RegisterModule(configuration);
146 | services.RegisterModule(configuration);
147 |
148 | services.RegisterModule(configuration);
149 | services.RegisterModule(configuration);
150 |
151 | services.RegisterModule(configuration);
152 | services.RegisterModule(configuration);
153 | services.RegisterModule(configuration);
154 |
155 | services.RegisterModule(configuration);
156 | services.RegisterModule(configuration);
157 |
158 | return services;
159 | }
160 |
161 | private async Task<(OrderDbContext, CommunicationDbContext)> CreateDatabase(string connectionString)
162 | {
163 | var orderOptions = new DbContextOptionsBuilder()
164 | .UseSqlServer(connectionString)
165 | .Options;
166 | var orderDbContext = new OrderDbContext(orderOptions);
167 | await orderDbContext.Database.MigrateAsync();
168 |
169 | var commOptions = new DbContextOptionsBuilder()
170 | .UseSqlServer(connectionString)
171 | .Options;
172 | var communicationDbContext = new CommunicationDbContext(commOptions);
173 | await communicationDbContext.Database.MigrateAsync();
174 |
175 | return (orderDbContext, communicationDbContext);
176 | }
177 | }
178 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # NuGet Symbol Packages
188 | *.snupkg
189 | # The packages folder can be ignored because of Package Restore
190 | **/[Pp]ackages/*
191 | # except build/, which is used as an MSBuild target.
192 | !**/[Pp]ackages/build/
193 | # Uncomment if necessary however generally it will be regenerated when needed
194 | #!**/[Pp]ackages/repositories.config
195 | # NuGet v3's project.json files produces more ignorable files
196 | *.nuget.props
197 | *.nuget.targets
198 |
199 | # Microsoft Azure Build Output
200 | csx/
201 | *.build.csdef
202 |
203 | # Microsoft Azure Emulator
204 | ecf/
205 | rcf/
206 |
207 | # Windows Store app package directories and files
208 | AppPackages/
209 | BundleArtifacts/
210 | Package.StoreAssociation.xml
211 | _pkginfo.txt
212 | *.appx
213 | *.appxbundle
214 | *.appxupload
215 |
216 | # Visual Studio cache files
217 | # files ending in .cache can be ignored
218 | *.[Cc]ache
219 | # but keep track of directories ending in .cache
220 | !?*.[Cc]ache/
221 |
222 | # Others
223 | ClientBin/
224 | ~$*
225 | *~
226 | *.dbmdl
227 | *.dbproj.schemaview
228 | *.jfm
229 | *.pfx
230 | *.publishsettings
231 | orleans.codegen.cs
232 |
233 | # Including strong name files can present a security risk
234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
235 | #*.snk
236 |
237 | # Since there are multiple workflows, uncomment next line to ignore bower_components
238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
239 | #bower_components/
240 |
241 | # RIA/Silverlight projects
242 | Generated_Code/
243 |
244 | # Backup & report files from converting an old project file
245 | # to a newer Visual Studio version. Backup files are not needed,
246 | # because we have git ;-)
247 | _UpgradeReport_Files/
248 | Backup*/
249 | UpgradeLog*.XML
250 | UpgradeLog*.htm
251 | ServiceFabricBackup/
252 | *.rptproj.bak
253 |
254 | # SQL Server files
255 | *.mdf
256 | *.ldf
257 | *.ndf
258 |
259 | # Business Intelligence projects
260 | *.rdl.data
261 | *.bim.layout
262 | *.bim_*.settings
263 | *.rptproj.rsuser
264 | *- [Bb]ackup.rdl
265 | *- [Bb]ackup ([0-9]).rdl
266 | *- [Bb]ackup ([0-9][0-9]).rdl
267 |
268 | # Microsoft Fakes
269 | FakesAssemblies/
270 |
271 | # GhostDoc plugin setting file
272 | *.GhostDoc.xml
273 |
274 | # Node.js Tools for Visual Studio
275 | .ntvs_analysis.dat
276 | node_modules/
277 |
278 | # Visual Studio 6 build log
279 | *.plg
280 |
281 | # Visual Studio 6 workspace options file
282 | *.opt
283 |
284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285 | *.vbw
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # CodeRush personal settings
303 | .cr/personal
304 |
305 | # Python Tools for Visual Studio (PTVS)
306 | __pycache__/
307 | *.pyc
308 |
309 | # Cake - Uncomment if you are using it
310 | # tools/**
311 | # !tools/packages.config
312 |
313 | # Tabs Studio
314 | *.tss
315 |
316 | # Telerik's JustMock configuration file
317 | *.jmconfig
318 |
319 | # BizTalk build output
320 | *.btp.cs
321 | *.btm.cs
322 | *.odx.cs
323 | *.xsd.cs
324 |
325 | # OpenCover UI analysis results
326 | OpenCover/
327 |
328 | # Azure Stream Analytics local run output
329 | ASALocalRun/
330 |
331 | # MSBuild Binary and Structured Log
332 | *.binlog
333 |
334 | # NVidia Nsight GPU debugger configuration file
335 | *.nvuser
336 |
337 | # MFractors (Xamarin productivity tool) working folder
338 | .mfractor/
339 |
340 | # Local History for Visual Studio
341 | .localhistory/
342 |
343 | # BeatPulse healthcheck temp database
344 | healthchecksdb
345 |
346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
347 | MigrationBackup/
348 |
349 | # Ionide (cross platform F# VS Code tools) working folder
350 | .ionide/
351 |
--------------------------------------------------------------------------------
/ModularMonolith/Shop.Tests.Unit/TransactionsTests.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Shop.Order.DataAccess.MsSql;
3 | using System;
4 | using System.Linq;
5 | using System.Transactions;
6 | using Microsoft.Data.SqlClient;
7 | using Microsoft.Extensions.Configuration;
8 | using Shop.Communication.DataAccess.MsSql;
9 | using Shop.Communication.Entities;
10 | using Xunit;
11 |
12 | namespace Shop.Tests.Unit
13 | {
14 | //https://docs.microsoft.com/en-us/ef/core/saving/transactions
15 | public class TransactionsTests
16 | {
17 | [Fact]
18 | public void DbTransaction_Rollback()
19 | {
20 | var connectionString = GetConnectionString();
21 | var connection = new SqlConnection(connectionString);
22 | connection.Open(); //required to begin transaction
23 |
24 | var transaction = connection.BeginTransaction();
25 |
26 | var communicationOptions = new DbContextOptionsBuilder()
27 | .UseSqlServer(connection)
28 | .Options;
29 | var communicationDbContext = new CommunicationDbContext(communicationOptions);
30 | communicationDbContext.Database.UseTransaction(transaction);
31 |
32 | var orderOptions = new DbContextOptionsBuilder()
33 | .UseSqlServer(connection)
34 | .Options;
35 | var orderDbContext = new OrderDbContext(orderOptions);
36 | orderDbContext.Database.UseTransaction(transaction);
37 |
38 | var order = new Order.Entities.Order();
39 | orderDbContext.Orders.Add(order);
40 | orderDbContext.SaveChanges();
41 |
42 | communicationDbContext.Emails.Add(new Email { Subject = "Sbj", Body = "Body", Address = "test@test.test", OrderId = order.Id });
43 | communicationDbContext.SaveChanges();
44 |
45 | transaction.Rollback();
46 |
47 | var orderDbContext1 = new OrderDbContext(orderOptions);
48 | var cnt = orderDbContext1.Orders.Count(x => x.Id == order.Id);
49 |
50 | Assert.Equal(0, cnt);
51 | }
52 |
53 | [Fact]
54 | public void DbTransaction_Commit()
55 | {
56 | var connectionString = GetConnectionString();
57 | var connection = new SqlConnection(connectionString);
58 | connection.Open(); //required to begin transaction
59 |
60 | var transaction = connection.BeginTransaction();
61 |
62 | var communicationOptions = new DbContextOptionsBuilder()
63 | .UseSqlServer(connection)
64 | .Options;
65 | var communicationDbContext = new CommunicationDbContext(communicationOptions);
66 | communicationDbContext.Database.UseTransaction(transaction);
67 |
68 | var orderOptions = new DbContextOptionsBuilder()
69 | .UseSqlServer(connection)
70 | .Options;
71 | var orderDbContext = new OrderDbContext(orderOptions);
72 | orderDbContext.Database.UseTransaction(transaction);
73 |
74 | var order = new Order.Entities.Order();
75 | orderDbContext.Orders.Add(order);
76 | orderDbContext.SaveChanges();
77 |
78 | communicationDbContext.Emails.Add(new Email { Subject = "Sbj", Body = "Body", Address = "test@test.test", OrderId = order.Id });
79 | communicationDbContext.SaveChanges();
80 |
81 | transaction.Commit();
82 |
83 | var newOrderContext = new OrderDbContext(orderOptions);
84 | var newCommContext = new CommunicationDbContext(communicationOptions);
85 |
86 | var ordersCount = newOrderContext.Orders.Count(x => x.Id == order.Id);
87 | var emailsCount = communicationDbContext.Emails.Count(x => x.OrderId == order.Id);
88 |
89 | Assert.Equal(1, ordersCount);
90 | Assert.Equal(1, emailsCount);
91 | }
92 |
93 | [Fact]
94 | public void TransactionScope_ConnectionString_Dispose()
95 | {
96 | var connectionString = GetConnectionString();
97 |
98 | using var scope = new TransactionScope(TransactionScopeOption.Required,
99 | new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted });
100 |
101 | var communicationOptions = new DbContextOptionsBuilder()
102 | .UseSqlServer(connectionString)
103 | .Options;
104 | var communicationDbContext = new CommunicationDbContext(communicationOptions);
105 |
106 | var orderOptions = new DbContextOptionsBuilder()
107 | .UseSqlServer(connectionString)
108 | .Options;
109 | var orderDbContext = new OrderDbContext(orderOptions);
110 |
111 | var order = new Order.Entities.Order();
112 | orderDbContext.Orders.Add(order);
113 | orderDbContext.SaveChanges();
114 |
115 | communicationDbContext.Emails.Add(new Email { Subject = "Sbj", Body = "Body", Address = "test@test.test", OrderId = order.Id});
116 | communicationDbContext.SaveChanges();
117 |
118 | scope.Dispose();
119 |
120 | var orderDbContext1 = new OrderDbContext(orderOptions);
121 | var cnt = orderDbContext1.Orders.Count(x => x.Id == order.Id);
122 |
123 | Assert.Equal(0, cnt);
124 | }
125 |
126 | [Fact]
127 | public void TransactionScope_Connection_Dispose()
128 | {
129 | var connectionString = GetConnectionString();
130 | var connection = new SqlConnection(connectionString);
131 |
132 | using var scope = new TransactionScope(TransactionScopeOption.Required,
133 | new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted });
134 |
135 | var communicationOptions = new DbContextOptionsBuilder()
136 | .UseSqlServer(connection)
137 | .Options;
138 | var communicationDbContext = new CommunicationDbContext(communicationOptions);
139 |
140 | var orderOptions = new DbContextOptionsBuilder()
141 | .UseSqlServer(connection)
142 | .Options;
143 | var orderDbContext = new OrderDbContext(orderOptions);
144 |
145 | var order = new Order.Entities.Order();
146 | orderDbContext.Orders.Add(order);
147 | orderDbContext.SaveChanges();
148 |
149 | communicationDbContext.Emails.Add(new Email { Subject = "Sbj", Body = "Body", Address = "test@test.test", OrderId = order.Id });
150 | communicationDbContext.SaveChanges();
151 |
152 | scope.Dispose();
153 |
154 | var orderDbContext1 = new OrderDbContext(orderOptions);
155 | var cnt = orderDbContext1.Orders.Count(x => x.Id == order.Id);
156 |
157 | Assert.Equal(0, cnt);
158 | }
159 |
160 | [Fact]
161 | public void CommittableTransaction_Connection_Rollback()
162 | {
163 | var connectionString = GetConnectionString();
164 | var connection = new SqlConnection(connectionString);
165 | connection.Open();
166 |
167 | using var transaction = new CommittableTransaction(
168 | new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted });
169 |
170 | var communicationOptions = new DbContextOptionsBuilder()
171 | .UseSqlServer(connection)
172 | .Options;
173 | var communicationDbContext = new CommunicationDbContext(communicationOptions);
174 | communicationDbContext.Database.EnlistTransaction(transaction);
175 |
176 | var orderOptions = new DbContextOptionsBuilder()
177 | .UseSqlServer(connection)
178 | .Options;
179 | var orderDbContext = new OrderDbContext(orderOptions);
180 | orderDbContext.Database.EnlistTransaction(transaction);
181 |
182 | var order = new Order.Entities.Order();
183 | orderDbContext.Orders.Add(order);
184 | orderDbContext.SaveChanges();
185 |
186 | communicationDbContext.Emails.Add(new Email { Subject = "Sbj", Body = "Body", Address = "test@test.test", OrderId = order.Id });
187 | communicationDbContext.SaveChanges();
188 |
189 | transaction.Rollback();
190 |
191 | var newOpts = new DbContextOptionsBuilder()
192 | .UseSqlServer(connectionString)
193 | .Options;
194 | var orderDbContext1 = new OrderDbContext(newOpts);
195 | var cnt = orderDbContext1.Orders.Count(x => x.Id == order.Id);
196 |
197 | Assert.Equal(0, cnt);
198 | }
199 |
200 | [Fact]
201 | public void CommittableTransaction_ConnectionString_PlatformNotSupportedException()
202 | {
203 | var connectionString = GetConnectionString();
204 |
205 | using var transaction = new CommittableTransaction(
206 | new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted });
207 |
208 | var communicationOptions = new DbContextOptionsBuilder()
209 | .UseSqlServer(connectionString)
210 | .Options;
211 | var communicationDbContext = new CommunicationDbContext(communicationOptions);
212 | communicationDbContext.Database.OpenConnection();
213 | communicationDbContext.Database.EnlistTransaction(transaction);
214 |
215 | var orderOptions = new DbContextOptionsBuilder()
216 | .UseSqlServer(connectionString)
217 | .Options;
218 | var orderDbContext = new OrderDbContext(orderOptions);
219 | orderDbContext.Database.OpenConnection();
220 | Assert.Throws(() => orderDbContext.Database.EnlistTransaction(transaction));
221 | }
222 |
223 | private string GetConnectionString()
224 | {
225 | var configuration = new ConfigurationBuilder()
226 | .AddJsonFile("appsettings.json")
227 | .Build();
228 | return configuration.GetConnectionString("MsSqlConnection");
229 | }
230 | }
231 | }
232 |
--------------------------------------------------------------------------------
/ModularMonolith/ModularMonolith.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.1.32228.430
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Communication", "Communication", "{B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Order", "Order", "{5529831C-372F-41B7-BD89-73C34FD80397}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.Entities", "Order\Shop.Order.Entities\Shop.Order.Entities.csproj", "{82C2E4BA-A095-4247-B164-2B6691AE07F6}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.DataAccess.Interfaces", "Order\Shop.Order.Infrastructure.Interfaces\Shop.Order.DataAccess.Interfaces.csproj", "{A3012741-D25B-4990-9F6C-4098494F6A6B}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.DataAccess.MsSql", "Order\Shop.Order.DataAccess.MsSql\Shop.Order.DataAccess.MsSql.csproj", "{B5AD31DD-B610-4425-8087-A49B2ABA5BC3}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.UseCases", "Order\Shop.Order.UseCases\Shop.Order.UseCases.csproj", "{82D1E4C5-86FA-415F-91D6-6CA6395083A7}"
17 | EndProject
18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.Controllers", "Order\Shop.Order.Controllers\Shop.Order.Controllers.csproj", "{627C8730-5EE7-4017-B5FB-21820A5B9EF7}"
19 | EndProject
20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Web", "Shop.Web\Shop.Web.csproj", "{2077BEBA-ED0C-4D6D-8AAE-DADAE60708C6}"
21 | EndProject
22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Tests.Unit", "Shop.Tests.Unit\Shop.Tests.Unit.csproj", "{34553222-3DA3-4853-B593-EA85BB894D65}"
23 | EndProject
24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{6770166F-32D3-48BA-9A33-EF94886EB326}"
25 | EndProject
26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModularMonolithAnalyzer", "Tools\ModularMonolithAnalyzer\ModularMonolithAnalyzer\ModularMonolithAnalyzer.csproj", "{7DBECBA8-5481-483E-B5F0-D573A819ADC8}"
27 | EndProject
28 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModularMonolithAnalyzer.Vsix", "Tools\ModularMonolithAnalyzer\ModularMonolithAnalyzer.Vsix\ModularMonolithAnalyzer.Vsix.csproj", "{BEDF4E64-8F5E-4E43-B030-957EABCE745E}"
29 | EndProject
30 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{D534B626-FBBD-486E-9135-8C5B01594A31}"
31 | EndProject
32 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B5A353C7-275C-42F8-9EFE-16F85B47D2C9}"
33 | EndProject
34 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Framework.UseCases.Interfaces", "Framework\Shop.Framework.Interfaces\Shop.Framework.UseCases.Interfaces.csproj", "{931F706E-EE62-4CF0-B85B-A06D2B7184E9}"
35 | EndProject
36 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Framework.UseCases.Implementation", "Framework\Shop.Framework.Implementation\Shop.Framework.UseCases.Implementation.csproj", "{1A56BD6F-44DF-4244-9BA2-EC3769CDAB49}"
37 | EndProject
38 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Utils", "Framework\Shop.Utils\Shop.Utils.csproj", "{A9327581-6022-48CB-AA81-68DF29740FE4}"
39 | EndProject
40 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.Contract", "Communication\Shop.Communication.Contract\Shop.Communication.Contract.csproj", "{E0B482FC-E224-465E-B6D3-9DD149269714}"
41 | EndProject
42 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.Contract.Implementation", "Communication\Shop.Communication.Contract.Implementation\Shop.Communication.Contract.Implementation.csproj", "{F3ACA84C-6313-45F7-AD52-24F360F94664}"
43 | EndProject
44 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.DataAccess.MsSql", "Communication\Shop.Communication.DataAccess.MsSql\Shop.Communication.DataAccess.MsSql.csproj", "{3D382D95-F469-40EA-A7A7-E57CBA2DBBA9}"
45 | EndProject
46 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.Entities", "Communication\Shop.Communication.Entities\Shop.Communication.Entities.csproj", "{8E937A0E-180E-42C1-8AA7-A4387910B87B}"
47 | EndProject
48 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.BackgroundJobs", "Communication\Shop.Communication.Infrastructure.Implementation\Shop.Communication.BackgroundJobs.csproj", "{BE7C6430-2312-482A-ADAF-C6839BB42186}"
49 | EndProject
50 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.DataAccess.Interfaces", "Communication\Shop.Communication.Infrastructure.Interfaces\Shop.Communication.DataAccess.Interfaces.csproj", "{78D2D1F9-7D31-4D89-8666-DA9DA96F46CA}"
51 | EndProject
52 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.Contract", "Order\Shop.Order.Contract\Shop.Order.Contract.csproj", "{E21D6980-A989-4DBA-A810-E455C4D88A05}"
53 | EndProject
54 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Order.Contract.Implementation", "Order\Shop.Order.Contract.Implementation\Shop.Order.Contract.Implementation.csproj", "{3E711D86-1488-4034-80C9-514ED3A6FEA9}"
55 | EndProject
56 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.UseCases", "Communication\Shop.Communication.UseCases\Shop.Communication.UseCases.csproj", "{54AAF5D4-7923-4ECD-920F-A06A0B79C743}"
57 | EndProject
58 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Framework.Entities", "Framework\Shop.Framework.Entities\Shop.Framework.Entities.csproj", "{25249563-C4B5-422F-8176-8371D950DDE5}"
59 | EndProject
60 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{6833A64D-E39D-4365-A2E8-2B93E894EAA9}"
61 | EndProject
62 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Emails.Interfaces", "Infrastructure\Shop.Email.Interfaces\Shop.Emails.Interfaces.csproj", "{A4395E5E-54A1-47CB-A505-47988A9C5DDE}"
63 | EndProject
64 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Communication.Controllers", "Communication\Shop.Communication.Controllers\Shop.Communication.Controllers.csproj", "{F11D745B-8460-4978-847E-00B771895F4B}"
65 | EndProject
66 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Emails.Implementation", "Infrastructure\Shop.Email.Implementation\Shop.Emails.Implementation.csproj", "{33EC6E92-F3F5-40CB-A59F-4FC8A42E7FEF}"
67 | EndProject
68 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1044D924-BC2C-4721-AFAE-8E83CFA31D3E}"
69 | ProjectSection(SolutionItems) = preProject
70 | Directory.Build.props = Directory.Build.props
71 | EndProjectSection
72 | EndProject
73 | Global
74 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
75 | Debug|Any CPU = Debug|Any CPU
76 | Release|Any CPU = Release|Any CPU
77 | EndGlobalSection
78 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
79 | {82C2E4BA-A095-4247-B164-2B6691AE07F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
80 | {82C2E4BA-A095-4247-B164-2B6691AE07F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
81 | {82C2E4BA-A095-4247-B164-2B6691AE07F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
82 | {82C2E4BA-A095-4247-B164-2B6691AE07F6}.Release|Any CPU.Build.0 = Release|Any CPU
83 | {A3012741-D25B-4990-9F6C-4098494F6A6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
84 | {A3012741-D25B-4990-9F6C-4098494F6A6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
85 | {A3012741-D25B-4990-9F6C-4098494F6A6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
86 | {A3012741-D25B-4990-9F6C-4098494F6A6B}.Release|Any CPU.Build.0 = Release|Any CPU
87 | {B5AD31DD-B610-4425-8087-A49B2ABA5BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
88 | {B5AD31DD-B610-4425-8087-A49B2ABA5BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
89 | {B5AD31DD-B610-4425-8087-A49B2ABA5BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
90 | {B5AD31DD-B610-4425-8087-A49B2ABA5BC3}.Release|Any CPU.Build.0 = Release|Any CPU
91 | {82D1E4C5-86FA-415F-91D6-6CA6395083A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
92 | {82D1E4C5-86FA-415F-91D6-6CA6395083A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
93 | {82D1E4C5-86FA-415F-91D6-6CA6395083A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
94 | {82D1E4C5-86FA-415F-91D6-6CA6395083A7}.Release|Any CPU.Build.0 = Release|Any CPU
95 | {627C8730-5EE7-4017-B5FB-21820A5B9EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
96 | {627C8730-5EE7-4017-B5FB-21820A5B9EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
97 | {627C8730-5EE7-4017-B5FB-21820A5B9EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
98 | {627C8730-5EE7-4017-B5FB-21820A5B9EF7}.Release|Any CPU.Build.0 = Release|Any CPU
99 | {2077BEBA-ED0C-4D6D-8AAE-DADAE60708C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
100 | {2077BEBA-ED0C-4D6D-8AAE-DADAE60708C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
101 | {2077BEBA-ED0C-4D6D-8AAE-DADAE60708C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
102 | {2077BEBA-ED0C-4D6D-8AAE-DADAE60708C6}.Release|Any CPU.Build.0 = Release|Any CPU
103 | {34553222-3DA3-4853-B593-EA85BB894D65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
104 | {34553222-3DA3-4853-B593-EA85BB894D65}.Debug|Any CPU.Build.0 = Debug|Any CPU
105 | {34553222-3DA3-4853-B593-EA85BB894D65}.Release|Any CPU.ActiveCfg = Release|Any CPU
106 | {34553222-3DA3-4853-B593-EA85BB894D65}.Release|Any CPU.Build.0 = Release|Any CPU
107 | {7DBECBA8-5481-483E-B5F0-D573A819ADC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
108 | {7DBECBA8-5481-483E-B5F0-D573A819ADC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
109 | {7DBECBA8-5481-483E-B5F0-D573A819ADC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
110 | {7DBECBA8-5481-483E-B5F0-D573A819ADC8}.Release|Any CPU.Build.0 = Release|Any CPU
111 | {BEDF4E64-8F5E-4E43-B030-957EABCE745E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
112 | {BEDF4E64-8F5E-4E43-B030-957EABCE745E}.Debug|Any CPU.Build.0 = Debug|Any CPU
113 | {BEDF4E64-8F5E-4E43-B030-957EABCE745E}.Release|Any CPU.ActiveCfg = Release|Any CPU
114 | {BEDF4E64-8F5E-4E43-B030-957EABCE745E}.Release|Any CPU.Build.0 = Release|Any CPU
115 | {931F706E-EE62-4CF0-B85B-A06D2B7184E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
116 | {931F706E-EE62-4CF0-B85B-A06D2B7184E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
117 | {931F706E-EE62-4CF0-B85B-A06D2B7184E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
118 | {931F706E-EE62-4CF0-B85B-A06D2B7184E9}.Release|Any CPU.Build.0 = Release|Any CPU
119 | {1A56BD6F-44DF-4244-9BA2-EC3769CDAB49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
120 | {1A56BD6F-44DF-4244-9BA2-EC3769CDAB49}.Debug|Any CPU.Build.0 = Debug|Any CPU
121 | {1A56BD6F-44DF-4244-9BA2-EC3769CDAB49}.Release|Any CPU.ActiveCfg = Release|Any CPU
122 | {1A56BD6F-44DF-4244-9BA2-EC3769CDAB49}.Release|Any CPU.Build.0 = Release|Any CPU
123 | {A9327581-6022-48CB-AA81-68DF29740FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
124 | {A9327581-6022-48CB-AA81-68DF29740FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
125 | {A9327581-6022-48CB-AA81-68DF29740FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
126 | {A9327581-6022-48CB-AA81-68DF29740FE4}.Release|Any CPU.Build.0 = Release|Any CPU
127 | {E0B482FC-E224-465E-B6D3-9DD149269714}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
128 | {E0B482FC-E224-465E-B6D3-9DD149269714}.Debug|Any CPU.Build.0 = Debug|Any CPU
129 | {E0B482FC-E224-465E-B6D3-9DD149269714}.Release|Any CPU.ActiveCfg = Release|Any CPU
130 | {E0B482FC-E224-465E-B6D3-9DD149269714}.Release|Any CPU.Build.0 = Release|Any CPU
131 | {F3ACA84C-6313-45F7-AD52-24F360F94664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
132 | {F3ACA84C-6313-45F7-AD52-24F360F94664}.Debug|Any CPU.Build.0 = Debug|Any CPU
133 | {F3ACA84C-6313-45F7-AD52-24F360F94664}.Release|Any CPU.ActiveCfg = Release|Any CPU
134 | {F3ACA84C-6313-45F7-AD52-24F360F94664}.Release|Any CPU.Build.0 = Release|Any CPU
135 | {3D382D95-F469-40EA-A7A7-E57CBA2DBBA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
136 | {3D382D95-F469-40EA-A7A7-E57CBA2DBBA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
137 | {3D382D95-F469-40EA-A7A7-E57CBA2DBBA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
138 | {3D382D95-F469-40EA-A7A7-E57CBA2DBBA9}.Release|Any CPU.Build.0 = Release|Any CPU
139 | {8E937A0E-180E-42C1-8AA7-A4387910B87B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
140 | {8E937A0E-180E-42C1-8AA7-A4387910B87B}.Debug|Any CPU.Build.0 = Debug|Any CPU
141 | {8E937A0E-180E-42C1-8AA7-A4387910B87B}.Release|Any CPU.ActiveCfg = Release|Any CPU
142 | {8E937A0E-180E-42C1-8AA7-A4387910B87B}.Release|Any CPU.Build.0 = Release|Any CPU
143 | {BE7C6430-2312-482A-ADAF-C6839BB42186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
144 | {BE7C6430-2312-482A-ADAF-C6839BB42186}.Debug|Any CPU.Build.0 = Debug|Any CPU
145 | {BE7C6430-2312-482A-ADAF-C6839BB42186}.Release|Any CPU.ActiveCfg = Release|Any CPU
146 | {BE7C6430-2312-482A-ADAF-C6839BB42186}.Release|Any CPU.Build.0 = Release|Any CPU
147 | {78D2D1F9-7D31-4D89-8666-DA9DA96F46CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
148 | {78D2D1F9-7D31-4D89-8666-DA9DA96F46CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
149 | {78D2D1F9-7D31-4D89-8666-DA9DA96F46CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
150 | {78D2D1F9-7D31-4D89-8666-DA9DA96F46CA}.Release|Any CPU.Build.0 = Release|Any CPU
151 | {E21D6980-A989-4DBA-A810-E455C4D88A05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
152 | {E21D6980-A989-4DBA-A810-E455C4D88A05}.Debug|Any CPU.Build.0 = Debug|Any CPU
153 | {E21D6980-A989-4DBA-A810-E455C4D88A05}.Release|Any CPU.ActiveCfg = Release|Any CPU
154 | {E21D6980-A989-4DBA-A810-E455C4D88A05}.Release|Any CPU.Build.0 = Release|Any CPU
155 | {3E711D86-1488-4034-80C9-514ED3A6FEA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
156 | {3E711D86-1488-4034-80C9-514ED3A6FEA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
157 | {3E711D86-1488-4034-80C9-514ED3A6FEA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
158 | {3E711D86-1488-4034-80C9-514ED3A6FEA9}.Release|Any CPU.Build.0 = Release|Any CPU
159 | {54AAF5D4-7923-4ECD-920F-A06A0B79C743}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
160 | {54AAF5D4-7923-4ECD-920F-A06A0B79C743}.Debug|Any CPU.Build.0 = Debug|Any CPU
161 | {54AAF5D4-7923-4ECD-920F-A06A0B79C743}.Release|Any CPU.ActiveCfg = Release|Any CPU
162 | {54AAF5D4-7923-4ECD-920F-A06A0B79C743}.Release|Any CPU.Build.0 = Release|Any CPU
163 | {25249563-C4B5-422F-8176-8371D950DDE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
164 | {25249563-C4B5-422F-8176-8371D950DDE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
165 | {25249563-C4B5-422F-8176-8371D950DDE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
166 | {25249563-C4B5-422F-8176-8371D950DDE5}.Release|Any CPU.Build.0 = Release|Any CPU
167 | {A4395E5E-54A1-47CB-A505-47988A9C5DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
168 | {A4395E5E-54A1-47CB-A505-47988A9C5DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
169 | {A4395E5E-54A1-47CB-A505-47988A9C5DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
170 | {A4395E5E-54A1-47CB-A505-47988A9C5DDE}.Release|Any CPU.Build.0 = Release|Any CPU
171 | {F11D745B-8460-4978-847E-00B771895F4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
172 | {F11D745B-8460-4978-847E-00B771895F4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
173 | {F11D745B-8460-4978-847E-00B771895F4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
174 | {F11D745B-8460-4978-847E-00B771895F4B}.Release|Any CPU.Build.0 = Release|Any CPU
175 | {33EC6E92-F3F5-40CB-A59F-4FC8A42E7FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
176 | {33EC6E92-F3F5-40CB-A59F-4FC8A42E7FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
177 | {33EC6E92-F3F5-40CB-A59F-4FC8A42E7FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
178 | {33EC6E92-F3F5-40CB-A59F-4FC8A42E7FEF}.Release|Any CPU.Build.0 = Release|Any CPU
179 | EndGlobalSection
180 | GlobalSection(SolutionProperties) = preSolution
181 | HideSolutionNode = FALSE
182 | EndGlobalSection
183 | GlobalSection(NestedProjects) = preSolution
184 | {82C2E4BA-A095-4247-B164-2B6691AE07F6} = {5529831C-372F-41B7-BD89-73C34FD80397}
185 | {A3012741-D25B-4990-9F6C-4098494F6A6B} = {5529831C-372F-41B7-BD89-73C34FD80397}
186 | {B5AD31DD-B610-4425-8087-A49B2ABA5BC3} = {5529831C-372F-41B7-BD89-73C34FD80397}
187 | {82D1E4C5-86FA-415F-91D6-6CA6395083A7} = {5529831C-372F-41B7-BD89-73C34FD80397}
188 | {627C8730-5EE7-4017-B5FB-21820A5B9EF7} = {5529831C-372F-41B7-BD89-73C34FD80397}
189 | {34553222-3DA3-4853-B593-EA85BB894D65} = {B5A353C7-275C-42F8-9EFE-16F85B47D2C9}
190 | {7DBECBA8-5481-483E-B5F0-D573A819ADC8} = {6770166F-32D3-48BA-9A33-EF94886EB326}
191 | {BEDF4E64-8F5E-4E43-B030-957EABCE745E} = {6770166F-32D3-48BA-9A33-EF94886EB326}
192 | {931F706E-EE62-4CF0-B85B-A06D2B7184E9} = {D534B626-FBBD-486E-9135-8C5B01594A31}
193 | {1A56BD6F-44DF-4244-9BA2-EC3769CDAB49} = {D534B626-FBBD-486E-9135-8C5B01594A31}
194 | {A9327581-6022-48CB-AA81-68DF29740FE4} = {D534B626-FBBD-486E-9135-8C5B01594A31}
195 | {E0B482FC-E224-465E-B6D3-9DD149269714} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
196 | {F3ACA84C-6313-45F7-AD52-24F360F94664} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
197 | {3D382D95-F469-40EA-A7A7-E57CBA2DBBA9} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
198 | {8E937A0E-180E-42C1-8AA7-A4387910B87B} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
199 | {BE7C6430-2312-482A-ADAF-C6839BB42186} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
200 | {78D2D1F9-7D31-4D89-8666-DA9DA96F46CA} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
201 | {E21D6980-A989-4DBA-A810-E455C4D88A05} = {5529831C-372F-41B7-BD89-73C34FD80397}
202 | {3E711D86-1488-4034-80C9-514ED3A6FEA9} = {5529831C-372F-41B7-BD89-73C34FD80397}
203 | {54AAF5D4-7923-4ECD-920F-A06A0B79C743} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
204 | {25249563-C4B5-422F-8176-8371D950DDE5} = {D534B626-FBBD-486E-9135-8C5B01594A31}
205 | {A4395E5E-54A1-47CB-A505-47988A9C5DDE} = {6833A64D-E39D-4365-A2E8-2B93E894EAA9}
206 | {F11D745B-8460-4978-847E-00B771895F4B} = {B9B3FCA7-B148-4EAE-9D3E-AB6BB915DD88}
207 | {33EC6E92-F3F5-40CB-A59F-4FC8A42E7FEF} = {6833A64D-E39D-4365-A2E8-2B93E894EAA9}
208 | EndGlobalSection
209 | GlobalSection(ExtensibilityGlobals) = postSolution
210 | SolutionGuid = {617CE5A3-534A-4FCB-84F2-118A4E06A762}
211 | EndGlobalSection
212 | EndGlobal
213 |
--------------------------------------------------------------------------------