Skip to content

Commit 30fd319

Browse files
committed
Updated thesetup to use RequestR 2.1.1
1 parent 1a196b6 commit 30fd319

13 files changed

Lines changed: 238 additions & 168 deletions

sources/Directory.Build.props

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<Company>Dust in the Wind</Company>
5+
<Product>RequestR</Product>
6+
<Copyright>Copyright © 2021-2025 Dust in the Wind</Copyright>
7+
8+
<Version>2.0.0</Version>
9+
<Authors>Alexandru Iuga</Authors>
10+
<Company>Dust in the Wind</Company>
11+
12+
<ImplicitUsings>enable</ImplicitUsings>
13+
<LangVersion>latest</LangVersion>
14+
</PropertyGroup>
15+
16+
</Project>

sources/RequestR.Demo/PresentProducts/PresentProductsRequest.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
namespace DustInTheWind.RequestR.Demo.Autofac.PresentProducts
17+
namespace DustInTheWind.RequestR.Demo.PresentProducts;
18+
19+
public class PresentProductsRequest
1820
{
19-
internal class PresentProductsRequest
20-
{
21-
}
2221
}

sources/RequestR.Demo/PresentProducts/PresentProductsRequestHandler.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

sources/RequestR.Demo/PresentProducts/PresentProductsRequestValidator.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
namespace DustInTheWind.RequestR.Demo.Autofac.PresentProducts
17+
namespace DustInTheWind.RequestR.Demo.PresentProducts;
18+
19+
internal class PresentProductsRequestValidator : IRequestValidator<PresentProductsRequest>
1820
{
19-
internal class PresentProductsRequestValidator : IRequestValidator<PresentProductsRequest>
21+
public void Validate(PresentProductsRequest request)
2022
{
21-
public void Validate(PresentProductsRequest request)
22-
{
23-
}
2423
}
2524
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// RequestR.Extensions.Autofac
2+
// Copyright (C) 2021 Dust in the Wind
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace DustInTheWind.RequestR.Demo.PresentProducts;
18+
19+
internal class PresentProductsUseCase : IUseCase<PresentProductsRequest, List<Product>>
20+
{
21+
public async Task<List<Product>> Execute(PresentProductsRequest request, CancellationToken cancellationToken)
22+
{
23+
return
24+
[
25+
new Product
26+
{
27+
Name = "Chocolate",
28+
Price = 10,
29+
Quantity = 15
30+
},
31+
new Product
32+
{
33+
Name = "Potato Chips",
34+
Price = 2,
35+
Quantity = 7
36+
},
37+
new Product
38+
{
39+
Name = "Water",
40+
Price = 5,
41+
Quantity = 10
42+
}
43+
];
44+
}
45+
}

sources/RequestR.Demo/Product.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
namespace DustInTheWind.RequestR.Demo.Autofac
17+
namespace DustInTheWind.RequestR.Demo
1818
{
1919
internal class Product
2020
{

sources/RequestR.Demo/Program.cs

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,37 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
using System;
18-
using System.Collections.Generic;
1917
using Autofac;
20-
using DustInTheWind.RequestR.Demo.Autofac.PresentProducts;
18+
using DustInTheWind.RequestR.Demo.PresentProducts;
2119
using DustInTheWind.RequestR.Extensions.Autofac;
2220

23-
namespace DustInTheWind.RequestR.Demo.Autofac
21+
namespace DustInTheWind.RequestR.Demo;
22+
23+
internal class Program
2424
{
25-
internal class Program
25+
private static void Main(string[] args)
2626
{
27-
private static void Main(string[] args)
27+
// Setup services
28+
ContainerBuilder containerBuilder = new();
29+
containerBuilder.RegisterUseCaseEngine(options =>
2830
{
29-
// Setup services
30-
ContainerBuilder containerBuilder = new ContainerBuilder();
31-
containerBuilder.AddRequestBus();
32-
33-
IContainer container = containerBuilder.Build();
31+
options.AddFromAssemblyContaining<PresentProductsRequest>();
32+
});
3433

35-
// Setup request bus
36-
RequestBus requestBus = container.Resolve<RequestBus>();
37-
requestBus.RegisterAllHandlers();
34+
IContainer container = containerBuilder.Build();
3835

39-
// Send request
40-
PresentProductsRequest request = new PresentProductsRequest();
41-
List<Product> products = requestBus.Send<PresentProductsRequest, List<Product>>(request);
36+
// Send request
37+
RequestBus requestBus = container.Resolve<RequestBus>();
38+
PresentProductsRequest request = new();
39+
List<Product> products = requestBus.Process<PresentProductsRequest, List<Product>>(request);
4240

43-
// Display response
44-
foreach (Product product in products)
45-
{
46-
Console.WriteLine();
47-
Console.WriteLine("Product: " + product.Name);
48-
Console.WriteLine("Price: " + product.Price);
49-
Console.WriteLine("Quantity: " + product.Quantity);
50-
}
41+
// Display response
42+
foreach (Product product in products)
43+
{
44+
Console.WriteLine();
45+
Console.WriteLine("Product: " + product.Name);
46+
Console.WriteLine("Price: " + product.Price);
47+
Console.WriteLine("Quantity: " + product.Quantity);
5148
}
5249
}
5350
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
6-
<AssemblyName>DustInTheWind.RequestR.Demo.Autofac</AssemblyName>
7-
<RootNamespace>DustInTheWind.RequestR.Demo.Autofac</RootNamespace>
8-
</PropertyGroup>
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<AssemblyName>DustInTheWind.$(MSBuildProjectName)</AssemblyName>
7+
<RootNamespace>DustInTheWind.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
8+
</PropertyGroup>
99

10-
<ItemGroup>
11-
<ProjectReference Include="..\RequestR.Extensions.Autofac\RequestR.Extensions.Autofac.csproj" />
12-
</ItemGroup>
10+
<ItemGroup>
11+
<ProjectReference Include="..\RequestR.Extensions.Autofac\RequestR.Extensions.Autofac.csproj" />
12+
</ItemGroup>
1313

1414
</Project>

sources/RequestR.Extensions.Autofac.sln

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30907.101
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.0.11205.157 d18.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RequestR.Extensions.Autofac", "RequestR.Extensions.Autofac\RequestR.Extensions.Autofac.csproj", "{AB9A73FF-9AD0-400C-84D4-D97B6B2BA87F}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestR.Demo", "RequestR.Demo\RequestR.Demo.csproj", "{C007549A-1EA5-4CBE-B89B-22F492B2BD69}"
99
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{1219F2F8-1411-4C82-A3D6-D1F912ABA2FA}"
11+
ProjectSection(SolutionItems) = preProject
12+
Directory.Build.props = Directory.Build.props
13+
EndProjectSection
14+
EndProject
1015
Global
1116
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1217
Debug|Any CPU = Debug|Any CPU
Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net462;netstandard2.1</TargetFrameworks>
5-
<AssemblyName>DustInTheWind.RequestR.Extensions.Autofac</AssemblyName>
6-
<RootNamespace>DustInTheWind.RequestR.Extensions.Autofac</RootNamespace>
7-
<Version>2.0.0</Version>
8-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
9-
<Authors>Dust in the Wind</Authors>
10-
<Description></Description>
11-
<PackageLicenseFile>license.txt</PackageLicenseFile>
12-
<PackageTags>autofac;requestr;mediator;mediator-pattern;request;response;business-layer;use-case;use-cases</PackageTags>
13-
<PackageId>RequestR.Extensions.Autofac</PackageId>
14-
<Product>RequestR.Extensions.Autofac</Product>
15-
<Copyright>Copyright 2021 Dust in the Wind</Copyright>
16-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
5+
<AssemblyName>DustInTheWind.$(MSBuildProjectName)</AssemblyName>
6+
<RootNamespace>DustInTheWind.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
177

18-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp3.1|AnyCPU'">
19-
<DocumentationFile>DustInTheWind.RequestR.Extensions.Autofac.xml</DocumentationFile>
20-
</PropertyGroup>
8+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
9+
<Description></Description>
10+
<PackageLicenseFile>license.txt</PackageLicenseFile>
11+
<PackageTags>autofac;requestr;mediator;mediator-pattern;request;response;business-layer;use-case;use-cases</PackageTags>
12+
<PackageId>RequestR.Extensions.Autofac</PackageId>
13+
</PropertyGroup>
2114

22-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp3.1|AnyCPU'">
23-
<DocumentationFile>DustInTheWind.RequestR.Extensions.Autofac.xml</DocumentationFile>
24-
</PropertyGroup>
15+
<ItemGroup>
16+
<PackageReference Include="Autofac" Version="6.1.0" />
17+
<PackageReference Include="RequestR" Version="2.1.1" />
18+
</ItemGroup>
2519

26-
<ItemGroup>
27-
<PackageReference Include="Autofac" Version="6.1.0" />
28-
<PackageReference Include="RequestR" Version="1.1.0" />
29-
</ItemGroup>
30-
31-
<ItemGroup>
32-
<None Include="..\license.txt">
33-
<Pack>True</Pack>
34-
<PackagePath></PackagePath>
35-
</None>
36-
</ItemGroup>
20+
<ItemGroup>
21+
<None Include="..\license.txt">
22+
<Pack>True</Pack>
23+
<PackagePath></PackagePath>
24+
</None>
25+
</ItemGroup>
3726

3827
</Project>

0 commit comments

Comments
 (0)