Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade JetBrains tools to 2023.3 EAP for .NET 8 support #228

Merged
merged 11 commits into from
Nov 22, 2023
Prev Previous commit
Next Next commit
Fix ConvertToPrimaryConstructor warnings
  • Loading branch information
tjementum committed Nov 22, 2023
commit 2dcdcf871516efca60fd80deb101e1f1e9cfb804
Original file line number Diff line number Diff line change
@@ -4,12 +4,9 @@
namespace PlatformPlatform.AccountManagement.Infrastructure.Users;

[UsedImplicitly]
internal sealed class UserRepository : RepositoryBase<User, UserId>, IUserRepository
internal sealed class UserRepository(AccountManagementDbContext accountManagementDbContext)
: RepositoryBase<User, UserId>(accountManagementDbContext), IUserRepository
{
public UserRepository(AccountManagementDbContext accountManagementDbContext) : base(accountManagementDbContext)
{
}

public async Task<bool> IsEmailFreeAsync(TenantId tenantId, string email, CancellationToken cancellationToken)
{
return !await DbSet.AnyAsync(u => u.TenantId == tenantId && u.Email == email, cancellationToken);
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
namespace PlatformPlatform.SharedKernel.ApiCore.Middleware;

public sealed class GlobalExceptionHandlerMiddleware(ILogger<GlobalExceptionHandlerMiddleware> logger,
IOptions<JsonOptions> jsonOptions) : IMiddleware
IOptions<JsonOptions> jsonOptions) : IMiddleware
{
private readonly JsonSerializerOptions _jsonSerializerOptions = jsonOptions.Value.SerializerOptions;
private readonly ILogger _logger = logger;
Original file line number Diff line number Diff line change
@@ -19,14 +19,10 @@ public interface IAggregateRoot : IAuditableEntity
void ClearDomainEvents();
}

public abstract class AggregateRoot<T> : AudibleEntity<T>, IAggregateRoot where T : IComparable<T>
public abstract class AggregateRoot<T>(T id) : AudibleEntity<T>(id), IAggregateRoot where T : IComparable<T>
{
private readonly List<IDomainEvent> _domainEvents = new();

protected AggregateRoot(T id) : base(id)
{
}

[NotMapped]
public IReadOnlyCollection<IDomainEvent> DomainEvents => _domainEvents.AsReadOnly();

Original file line number Diff line number Diff line change
@@ -7,12 +7,9 @@ namespace PlatformPlatform.SharedKernel.InfrastructureCore.EntityFramework;
/// The SharedKernelDbContext class represents the Entity Framework Core DbContext for managing data access to the
/// database, like creation, querying, and updating of <see cref="IAggregateRoot" /> entities.
/// </summary>
public abstract class SharedKernelDbContext<TContext> : DbContext where TContext : DbContext
public abstract class SharedKernelDbContext<TContext>(DbContextOptions<TContext> options)
: DbContext(options) where TContext : DbContext
{
protected SharedKernelDbContext(DbContextOptions<TContext> options) : base(options)
{
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
18 changes: 3 additions & 15 deletions application/shared-kernel/Tests/DomainCore/Entities/EntityTests.cs
Original file line number Diff line number Diff line change
@@ -167,31 +167,19 @@ public void GetHashCode_SameIdsDifferentProperties_ShouldHaveSameHashCode()
public sealed record StronglyTypedId(long Value) : StronglyTypedLongId<StronglyTypedId>(Value);

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public class StronglyTypedIdEntity : Entity<StronglyTypedId>
public class StronglyTypedIdEntity() : Entity<StronglyTypedId>(StronglyTypedId.NewId())
{
public StronglyTypedIdEntity() : base(StronglyTypedId.NewId())
{
}

public required string Name { get; init; }
}

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public class GuidEntity : Entity<Guid>
public class GuidEntity(Guid id) : Entity<Guid>(id)
{
public GuidEntity(Guid id) : base(id)
{
}

public required string Name { get; init; }
}

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public class StringEntity : Entity<string>
public class StringEntity(string id) : Entity<string>(id)
{
public StringEntity(string id) : base(id)
{
}

public required string Name { get; init; }
}