Skip to content

Commit 207cec0

Browse files
Merge pull request #158 from AntonioFalcao/release
Updating
2 parents 76f68f3 + 1c3253d commit 207cec0

26 files changed

+1934
-1937
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Microsoft_DependencyInjection_Version>5.0.0</Microsoft_DependencyInjection_Version>
1111

1212
<!--EF Core-->
13-
<Microsoft_EntityFrameworkCore_Version>5.0.3</Microsoft_EntityFrameworkCore_Version>
13+
<Microsoft_EntityFrameworkCore_Version>6.0.0-preview.1.21102.2</Microsoft_EntityFrameworkCore_Version>
1414

1515
<!--GraphQL-->
1616
<GraphQL_Server_Version>4.4.1</GraphQL_Server_Version>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ Based on cloud-native concepts, **Readiness** and **Liveness** integrity verific
353353
> `/health/live`
354354
> Check if the instance is running and all the dependencies too.
355355

356-
> `/health/ready`
356+
> `/health/ready`
357357
> Check if the instance and all the dependencies are ready to attend to all functionalities.
358358

359359
Web API
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Linq;
43
using System.Reflection;
4+
using Microsoft.Extensions.DependencyModel;
55

66
namespace Dotnet5.GraphQL3.CrossCutting
77
{
88
public static class Application
99
{
1010
public static string Prefix { get; } = Assembly.GetEntryAssembly()?.FullName?.Substring(0, 16);
11-
public static IEnumerable<Assembly> Assemblies { get; } =
12-
AppDomain.CurrentDomain.GetAssemblies().Where(assembly => assembly.FullName?.StartsWith(Prefix) ?? false);
11+
12+
public static IEnumerable<Assembly> Assemblies { get; } =
13+
DependencyContext.Default.RuntimeLibraries
14+
.Where(library => library.Name.Contains(Prefix))
15+
.SelectMany(library => library.GetDefaultAssemblyNames(DependencyContext.Default))
16+
.Select(Assembly.Load);
1317
}
1418
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<ItemGroup>
4-
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)" />
5-
<PackageReference Include="GraphQL" Version="$(GraphQL_Version)" />
6-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)" />
3+
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)"/>
4+
<PackageReference Include="GraphQL" Version="$(GraphQL_Version)"/>
5+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)"/>
6+
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="3.1.6"/>
77
</ItemGroup>
8-
98
</Project>
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<ItemGroup>
4-
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)" />
5-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)" />
6-
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
3+
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)"/>
4+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)"/>
5+
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
76
</ItemGroup>
8-
97
<ItemGroup>
10-
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj" />
8+
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj"/>
119
</ItemGroup>
12-
1310
</Project>
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<ItemGroup>
4-
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)" />
5-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)" />
6-
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
3+
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)"/>
4+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)"/>
5+
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
76
</ItemGroup>
8-
97
<ItemGroup>
10-
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj" />
8+
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj"/>
119
</ItemGroup>
12-
1310
</Project>

src/Dotnet5.GraphQL3.Services.Abstractions/Dotnet5.GraphQL3.Services.Abstractions.csproj

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<ItemGroup>
4-
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)" />
5-
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapper_DependencyInjection_Version)" />
6-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)" />
7-
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
3+
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)"/>
4+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapper_DependencyInjection_Version)"/>
5+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)"/>
6+
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
87
</ItemGroup>
9-
108
<ItemGroup>
11-
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj" />
12-
<ProjectReference Include="..\Dotnet5.GraphQL3.Repositories.Abstractions\Dotnet5.GraphQL3.Repositories.Abstractions.csproj" />
13-
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj" />
9+
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj"/>
10+
<ProjectReference Include="..\Dotnet5.GraphQL3.Repositories.Abstractions\Dotnet5.GraphQL3.Repositories.Abstractions.csproj"/>
11+
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj"/>
1412
</ItemGroup>
1513

1614
<ItemGroup>

src/Dotnet5.GraphQL3.Services.Abstractions/Models/Model.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ namespace Dotnet5.GraphQL3.Services.Abstractions.Models
33
public abstract record Model<TId>
44
where TId : struct
55
{
6-
private TId? Id { get; init; }
6+
public TId? Id { get; init; }
77
}
88
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<ItemGroup>
4-
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)" />
3+
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)"/>
4+
</ItemGroup>
5+
<ItemGroup>
6+
<ProjectReference Include="..\Dotnet5.GraphQL3.Domain.Abstractions\Dotnet5.GraphQL3.Domain.Abstractions.csproj"/>
57
</ItemGroup>
6-
78
<ItemGroup>
89
<EmbeddedResource Update="Resource.resx">
910
<Generator>ResXFileCodeGenerator</Generator>
1011
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
1112
</EmbeddedResource>
1213
</ItemGroup>
13-
1414
<ItemGroup>
1515
<Compile Update="Resource.Designer.cs">
1616
<DesignTime>True</DesignTime>
1717
<AutoGen>True</AutoGen>
1818
<DependentUpon>DomainResource.resx</DependentUpon>
1919
</Compile>
2020
</ItemGroup>
21-
22-
<ItemGroup>
23-
<ProjectReference Include="..\Dotnet5.GraphQL3.Domain.Abstractions\Dotnet5.GraphQL3.Domain.Abstractions.csproj" />
24-
</ItemGroup>
25-
2621
</Project>

src/Dotnet5.GraphQL3.Store.Domain/Entities/Products/Product.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ namespace Dotnet5.GraphQL3.Store.Domain.Entities.Products
99
{
1010
public abstract class Product : Entity<Guid>, IProduct
1111
{
12-
protected Product(Guid id, string description, DateTimeOffset introduceAt, string name, string photoUrl, decimal price,
13-
ProductType productType, int rating, int stock, Option option)
12+
private readonly HashSet<Review> _reviews = new();
13+
14+
protected Product(Guid id, string description, DateTimeOffset introduceAt, string name, string photoUrl, decimal price, ProductType productType, int rating, int stock, Option option)
1415
{
1516
Id = id;
1617
Description = description;
@@ -22,11 +23,13 @@ protected Product(Guid id, string description, DateTimeOffset introduceAt, strin
2223
Rating = rating;
2324
Stock = stock;
2425
Option = option;
25-
Reviews = new List<Review>();
2626
}
2727

2828
protected Product() { }
2929

30+
public IReadOnlyCollection<Review> Reviews
31+
=> _reviews;
32+
3033
public string Description { get; }
3134
public DateTimeOffset IntroduceAt { get; }
3235
public string Name { get; }
@@ -36,7 +39,6 @@ protected Product() { }
3639
public ProductType ProductType { get; }
3740
public int Rating { get; }
3841
public int Stock { get; }
39-
public ICollection<Review> Reviews { get; }
4042

4143
public void AddReview(Review review)
4244
{
@@ -46,8 +48,8 @@ public void AddReview(Review review)
4648
return;
4749
}
4850

49-
if (Reviews.Contains(review)) return;
50-
Reviews.Add(review);
51+
if (_reviews.Contains(review)) return;
52+
_reviews.Add(review);
5153
}
5254
}
5355
}
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
2-
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Backpacks;
3-
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
4-
using Microsoft.EntityFrameworkCore;
5-
using Microsoft.EntityFrameworkCore.Metadata.Builders;
6-
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7-
8-
namespace Dotnet5.GraphQL3.Store.Repositories.Configs.Products
9-
{
10-
public class BackpackConfig : IEntityTypeConfiguration<Backpack>
11-
{
12-
public void Configure(EntityTypeBuilder<Backpack> builder)
13-
{
14-
builder
15-
.HasBaseType<Product>();
16-
17-
builder
18-
.Property(x => x.BackpackType)
19-
.HasConversion(new EnumToStringConverter<BackpackType>());
20-
}
21-
}
1+
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
2+
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Backpacks;
3+
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
4+
using Microsoft.EntityFrameworkCore;
5+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
6+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7+
8+
namespace Dotnet5.GraphQL3.Store.Repositories.Configurations.Products
9+
{
10+
public class BackpackConfiguration : IEntityTypeConfiguration<Backpack>
11+
{
12+
public void Configure(EntityTypeBuilder<Backpack> builder)
13+
{
14+
builder
15+
.HasBaseType<Product>();
16+
17+
builder
18+
.Property(x => x.BackpackType)
19+
.HasConversion(new EnumToStringConverter<BackpackType>());
20+
}
21+
}
2222
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
2-
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Boots;
3-
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
4-
using Microsoft.EntityFrameworkCore;
5-
using Microsoft.EntityFrameworkCore.Metadata.Builders;
6-
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7-
8-
namespace Dotnet5.GraphQL3.Store.Repositories.Configs.Products
9-
{
10-
public class BootConfig : IEntityTypeConfiguration<Boot>
11-
{
12-
public void Configure(EntityTypeBuilder<Boot> builder)
13-
{
14-
builder
15-
.HasBaseType<Product>();
16-
17-
builder
18-
.Property(x => x.Size);
19-
20-
builder
21-
.Property(x => x.BootType)
22-
.HasConversion(new EnumToStringConverter<BootType>());
23-
}
24-
}
1+
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
2+
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Boots;
3+
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
4+
using Microsoft.EntityFrameworkCore;
5+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
6+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7+
8+
namespace Dotnet5.GraphQL3.Store.Repositories.Configurations.Products
9+
{
10+
public class BootConfiguration : IEntityTypeConfiguration<Boot>
11+
{
12+
public void Configure(EntityTypeBuilder<Boot> builder)
13+
{
14+
builder
15+
.HasBaseType<Product>();
16+
17+
builder
18+
.Property(x => x.Size);
19+
20+
builder
21+
.Property(x => x.BootType)
22+
.HasConversion(new EnumToStringConverter<BootType>());
23+
}
24+
}
2525
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
2-
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Kayaks;
3-
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
4-
using Microsoft.EntityFrameworkCore;
5-
using Microsoft.EntityFrameworkCore.Metadata.Builders;
6-
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7-
8-
namespace Dotnet5.GraphQL3.Store.Repositories.Configs.Products
9-
{
10-
public class KayakConfig : IEntityTypeConfiguration<Kayak>
11-
{
12-
public void Configure(EntityTypeBuilder<Kayak> builder)
13-
{
14-
builder
15-
.HasBaseType<Product>();
16-
17-
builder
18-
.Property(x => x.KayakType)
19-
.HasConversion(new EnumToStringConverter<KayakType>());
20-
21-
builder
22-
.Property(x => x.AmountOfPerson);
23-
}
24-
}
1+
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
2+
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Kayaks;
3+
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
4+
using Microsoft.EntityFrameworkCore;
5+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
6+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7+
8+
namespace Dotnet5.GraphQL3.Store.Repositories.Configurations.Products
9+
{
10+
public class KayakConfiguration : IEntityTypeConfiguration<Kayak>
11+
{
12+
public void Configure(EntityTypeBuilder<Kayak> builder)
13+
{
14+
builder
15+
.HasBaseType<Product>();
16+
17+
builder
18+
.Property(x => x.KayakType)
19+
.HasConversion(new EnumToStringConverter<KayakType>());
20+
21+
builder
22+
.Property(x => x.AmountOfPerson);
23+
}
24+
}
2525
}

0 commit comments

Comments
 (0)