Skip to content

Commit 602b19a

Browse files
Merge pull request #124 from AntonioFalcao/release
Updating
2 parents fd4077c + 8ec709e commit 602b19a

File tree

26 files changed

+288
-287
lines changed

26 files changed

+288
-287
lines changed

Directory.Build.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<Microsoft_DependencyInjection_Version>5.0.0</Microsoft_DependencyInjection_Version>
1111

1212
<!--EF Core-->
13-
<Microsoft_EntityFrameworkCore_Version>5.0.1</Microsoft_EntityFrameworkCore_Version>
13+
<Microsoft_EntityFrameworkCore_Version>5.0.2</Microsoft_EntityFrameworkCore_Version>
1414

1515
<!--GraphQL-->
16-
<GraphQL_Server_Version>4.4.0</GraphQL_Server_Version>
17-
<GraphQL_Client_Version>3.2.0</GraphQL_Client_Version>
18-
<GraphQL_Version>3.2.0</GraphQL_Version>
16+
<GraphQL_Server_Version>4.4.1</GraphQL_Server_Version>
17+
<GraphQL_Client_Version>3.2.1</GraphQL_Client_Version>
18+
<GraphQL_Version>3.3.1</GraphQL_Version>
1919

2020
<!--AutoMapper-->
2121
<AutoMapper_DependencyInjection_Version>8.1.0</AutoMapper_DependencyInjection_Version>
2222
<AutoMapper_Version>10.1.1</AutoMapper_Version>
2323

2424
<!--Others-->
25-
<FluentValidation_Version>9.3.0</FluentValidation_Version>
25+
<FluentValidation_Version>9.4.0</FluentValidation_Version>
2626
<Scrutor_Version>3.3.0</Scrutor_Version>
2727

2828
</PropertyGroup>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Dotnet5.GraphQL3.CrossCutting.Notifications;
2-
using Microsoft.Extensions.DependencyInjection;
3-
4-
namespace Dotnet5.GraphQL3.CrossCutting.DependencyInjection
5-
{
6-
public static class ConfigureService
7-
{
8-
public static IServiceCollection AddNotificationContext(this IServiceCollection services)
9-
=> services.AddScoped<INotificationContext, NotificationContext>();
10-
}
1+
using Dotnet5.GraphQL3.CrossCutting.Notifications;
2+
using Microsoft.Extensions.DependencyInjection;
3+
4+
namespace Dotnet5.GraphQL3.CrossCutting.Extensions.DependencyInjection
5+
{
6+
public static class ServiceCollectionExtensions
7+
{
8+
public static IServiceCollection AddNotificationContext(this IServiceCollection services)
9+
=> services.AddScoped<INotificationContext, NotificationContext>();
10+
}
1111
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
using Dotnet5.GraphQL3.CrossCutting.Extensions;
2-
using Dotnet5.GraphQL3.Domain.Abstractions.Builders;
3-
using Microsoft.Extensions.DependencyInjection;
4-
using Scrutor;
5-
6-
namespace Dotnet5.GraphQL3.Domain.Abstractions.DependencyInjection
7-
{
8-
public static class ConfigureService
9-
{
10-
public static IServiceCollection AddBuilders(this IServiceCollection services)
11-
=> services.Scan(selector
12-
=> selector
13-
.FromApplicationDependencies(assembly
14-
=> assembly.FullName?.StartsWith(assembly.GetEntryAssemblySuffix()) ?? default)
15-
.AddClasses(filter
16-
=> filter.AssignableToAny(typeof(IBuilder<,>)))
17-
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
18-
.AsImplementedInterfaces()
19-
.WithScopedLifetime());
20-
}
1+
using Dotnet5.GraphQL3.CrossCutting.Extensions;
2+
using Dotnet5.GraphQL3.Domain.Abstractions.Builders;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using Scrutor;
5+
6+
namespace Dotnet5.GraphQL3.Domain.Abstractions.Extensions.DependencyInjection
7+
{
8+
public static class ServiceCollectionExtensions
9+
{
10+
public static IServiceCollection AddBuilders(this IServiceCollection services)
11+
=> services.Scan(selector
12+
=> selector
13+
.FromApplicationDependencies(assembly
14+
=> assembly.FullName?.StartsWith(assembly.GetEntryAssemblySuffix()) ?? default)
15+
.AddClasses(filter
16+
=> filter.AssignableToAny(typeof(IBuilder<,>)))
17+
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
18+
.AsImplementedInterfaces()
19+
.WithScopedLifetime());
20+
}
2121
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)"/>
5-
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
4+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)" />
5+
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
66
</ItemGroup>
77

88
<ItemGroup>
9-
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj"/>
9+
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj" />
1010
</ItemGroup>
1111

1212
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
using Dotnet5.GraphQL3.CrossCutting.Extensions;
2-
using Dotnet5.GraphQL3.Repositories.Abstractions.UnitsOfWork;
3-
using Microsoft.Extensions.DependencyInjection;
4-
using Scrutor;
5-
6-
namespace Dotnet5.GraphQL3.Repositories.Abstractions.DependencyInjection
7-
{
8-
public static class ConfigureService
9-
{
10-
public static IServiceCollection AddRepositories(this IServiceCollection services)
11-
=> services.Scan(selector
12-
=> selector
13-
.FromApplicationDependencies(assembly
14-
=> assembly.FullName?.StartsWith(assembly.GetEntryAssemblySuffix()) ?? default)
15-
.AddClasses(filter
16-
=> filter.AssignableToAny(typeof(IRepository<,>)))
17-
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
18-
.AsImplementedInterfaces()
19-
.WithScopedLifetime());
20-
21-
public static IServiceCollection AddUnitOfWork(this IServiceCollection services)
22-
=> services.AddScoped<IUnitOfWork, UnitOfWork>();
23-
}
1+
using Dotnet5.GraphQL3.CrossCutting.Extensions;
2+
using Dotnet5.GraphQL3.Repositories.Abstractions.UnitsOfWork;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using Scrutor;
5+
6+
namespace Dotnet5.GraphQL3.Repositories.Abstractions.Extensions.DependencyInjection
7+
{
8+
public static class ServiceCollectionExtensions
9+
{
10+
public static IServiceCollection AddRepositories(this IServiceCollection services)
11+
=> services.Scan(selector
12+
=> selector
13+
.FromApplicationDependencies(assembly
14+
=> assembly.FullName?.StartsWith(assembly.GetEntryAssemblySuffix()) ?? default)
15+
.AddClasses(filter
16+
=> filter.AssignableToAny(typeof(IRepository<,>)))
17+
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
18+
.AsImplementedInterfaces()
19+
.WithScopedLifetime());
20+
21+
public static IServiceCollection AddUnitOfWork(this IServiceCollection services)
22+
=> services.AddScoped<IUnitOfWork, UnitOfWork>();
23+
}
2424
}

src/Dotnet5.GraphQL3.Repositories.Abstractions/Pages/PageInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Dotnet5.GraphQL3.Repositories.Abstractions.Pages
22
{
3-
public class PageInfo
3+
public record PageInfo
44
{
55
public int Current { get; init; }
66
public int Size { get; init; }

src/Dotnet5.GraphQL3.Repositories.Abstractions/Pages/PageParams.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Dotnet5.GraphQL3.Repositories.Abstractions.Pages
22
{
3-
public class PageParams
3+
public record PageParams
44
{
55
private const int DefaultSize = 10;
66
private const int DefaultIndex = 1;

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<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)"/>
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)" />
88
</ItemGroup>
99

1010
<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"/>
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" />
1414
</ItemGroup>
1515

1616
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
using System;
2-
using System.Linq;
3-
using System.Reactive.Subjects;
4-
using System.Reflection;
5-
using AutoMapper;
6-
using Dotnet5.GraphQL3.Services.Abstractions.Messages;
7-
using Microsoft.Extensions.DependencyInjection;
8-
using Scrutor;
9-
10-
namespace Dotnet5.GraphQL3.Services.Abstractions.DependencyInjection
11-
{
12-
public static class ConfigureService
13-
{
14-
public static IServiceCollection AddApplicationServices(this IServiceCollection services)
15-
=> services.Scan(selector
16-
=> selector
17-
.FromApplicationDependencies(assembly
18-
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
19-
.AddClasses(filter
20-
=> filter.AssignableToAny(typeof(IService<,,>)))
21-
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
22-
.AsImplementedInterfaces()
23-
.WithScopedLifetime());
24-
25-
public static IServiceCollection AddMessageServices(this IServiceCollection services)
26-
=> services.Scan(selector
27-
=> selector
28-
.FromApplicationDependencies(assembly
29-
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
30-
.AddClasses(filter
31-
=> filter.AssignableToAny(typeof(IMessageService<,,>)))
32-
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
33-
.AsImplementedInterfaces()
34-
.WithSingletonLifetime());
35-
36-
public static IServiceCollection AddSubjects(this IServiceCollection services)
37-
=> services.AddSingleton(typeof(ISubject<>), typeof(ReplaySubject<>));
38-
39-
public static IServiceCollection AddAutoMapper(this IServiceCollection services)
40-
=> services.AddAutoMapper(
41-
AppDomain.CurrentDomain.GetAssemblies()
42-
.Where(x => x.FullName?
43-
.Contains(GetAssemblySuffix()) ?? false));
44-
45-
private static string GetAssemblySuffix()
46-
=> Assembly.GetEntryAssembly()?.FullName?.Substring(0, 16);
47-
}
1+
using System;
2+
using System.Linq;
3+
using System.Reactive.Subjects;
4+
using System.Reflection;
5+
using AutoMapper;
6+
using Dotnet5.GraphQL3.Services.Abstractions.Messages;
7+
using Microsoft.Extensions.DependencyInjection;
8+
using Scrutor;
9+
10+
namespace Dotnet5.GraphQL3.Services.Abstractions.Extensions.DependencyInjection
11+
{
12+
public static class ServiceCollectionExtensions
13+
{
14+
public static IServiceCollection AddApplicationServices(this IServiceCollection services)
15+
=> services.Scan(selector
16+
=> selector
17+
.FromApplicationDependencies(assembly
18+
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
19+
.AddClasses(filter
20+
=> filter.AssignableToAny(typeof(IService<,,>)))
21+
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
22+
.AsImplementedInterfaces()
23+
.WithScopedLifetime());
24+
25+
public static IServiceCollection AddMessageServices(this IServiceCollection services)
26+
=> services.Scan(selector
27+
=> selector
28+
.FromApplicationDependencies(assembly
29+
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
30+
.AddClasses(filter
31+
=> filter.AssignableToAny(typeof(IMessageService<,,>)))
32+
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
33+
.AsImplementedInterfaces()
34+
.WithSingletonLifetime());
35+
36+
public static IServiceCollection AddSubjects(this IServiceCollection services)
37+
=> services.AddSingleton(typeof(ISubject<>), typeof(ReplaySubject<>));
38+
39+
public static IServiceCollection AddAutoMapper(this IServiceCollection services)
40+
=> services.AddAutoMapper(
41+
AppDomain.CurrentDomain.GetAssemblies()
42+
.Where(x => x.FullName?
43+
.Contains(GetAssemblySuffix()) ?? false));
44+
45+
private static string GetAssemblySuffix()
46+
=> Assembly.GetEntryAssembly()?.FullName?.Substring(0, 16);
47+
}
4848
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace Dotnet5.GraphQL3.Services.Abstractions.Models
22
{
3-
public abstract class Model<TId>
3+
public abstract record Model<TId>
44
where TId : struct
55
{
6-
private TId? Id { get; set; }
6+
private TId? Id { get; init; }
77
}
88
}

src/Dotnet5.GraphQL3.Services.Abstractions/Service.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public virtual TEntity Save(TModel model)
110110
return OnSave(entity);
111111
}
112112

113-
public virtual async Task<TEntity> SaveAsync(TModel model, CancellationToken cancellationToken = default)
113+
public virtual async Task<TEntity> SaveAsync(TModel model, CancellationToken cancellationToken)
114114
{
115115
if (IsValid(model) is false) return default;
116116
var entity = Mapper.Map<TEntity>(model);
@@ -133,15 +133,15 @@ protected TEntity OnEdit(TEntity entity)
133133
return entity;
134134
}
135135

136-
protected async Task<TEntity> OnEditAsync(TEntity entity, CancellationToken cancellationToken = default)
136+
protected async Task<TEntity> OnEditAsync(TEntity entity, CancellationToken cancellationToken)
137137
{
138138
if (IsValid(entity) is false) return default;
139139
await Repository.UpdateAsync(entity, cancellationToken);
140140
await UnitOfWork.SaveChangesAsync(cancellationToken);
141141
return entity;
142142
}
143143

144-
protected async Task<TEntity> OnSaveAsync(TEntity entity, CancellationToken cancellationToken = default)
144+
protected async Task<TEntity> OnSaveAsync(TEntity entity, CancellationToken cancellationToken)
145145
{
146146
if (IsValid(entity) is false) return default;
147147
await Repository.AddAsync(entity, cancellationToken);

0 commit comments

Comments
 (0)