Skip to content

Commit

Permalink
Automated dotnet-format update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 25, 2023
1 parent 4638239 commit 07dc589
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BUTR.Site.NexusMods.Server.Models;
namespace BUTR.Site.NexusMods.Server.Models;

public static class OpenApiExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace BUTR.Site.NexusMods.Server.Models;
public static readonly TType User = From(ApplicationRoles.User);
public static readonly TType Moderator = From(ApplicationRoles.Moderator);
public static readonly TType Administrator = From(ApplicationRoles.Administrator);

public static TType DefaultValue => Anonymous;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace BUTR.Site.NexusMods.Server.Models;
public readonly partial record struct NexusModsApiKey : IVogen<TType, TValueType>, IHasDefaultValue<TType>
{
public static readonly TType None = From(string.Empty);

public static NexusModsApiKey DefaultValue => None;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace BUTR.Site.NexusMods.Server.Models;
public static readonly TType None = From(0);

public static TType DefaultValue => None;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace BUTR.Site.NexusMods.Server.Models;
public static readonly TType Bannerlord = From(TenantUtils.BannerlordGameDomain);
public static readonly TType Rimworld = From(TenantUtils.RimworldGameDomain);
public static readonly TType StardewValley = From(TenantUtils.StardewValleyGameDomain);

public static TType DefaultValue => None;

public static IEnumerable<TType> Values
Expand All @@ -24,7 +24,7 @@ public static IEnumerable<TType> Values
yield return StardewValley;
}
}

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace BUTR.Site.NexusMods.Server.Models;
public readonly partial record struct NexusModsModId : IVogen<TType, TValueType>, IVogenParsable<TType, TValueType>, IVogenSpanParsable<TType, TValueType>, IVogenUtf8SpanParsable<TType, TValueType>
{
public static readonly TType None = From(0);

public static TType DefaultValue => None;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace BUTR.Site.NexusMods.Server.Models;
public readonly partial record struct NexusModsUserEMail : IVogen<TType, TValueType>, IHasDefaultValue<TType>
{
public static readonly TType Empty = From(string.Empty);

public static TType DefaultValue => Empty;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace BUTR.Site.NexusMods.Server.Models;
public readonly partial record struct NexusModsUserId : IVogen<TType, TValueType>, IVogenParsable<TType, TValueType>, IVogenSpanParsable<TType, TValueType>, IVogenUtf8SpanParsable<TType, TValueType>, IHasDefaultValue<TType>
{
public static readonly TType None = From(0);

public static TType DefaultValue => None;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace BUTR.Site.NexusMods.Server.Models;
public readonly partial record struct NexusModsUserName : IVogen<TType, TValueType>, IHasDefaultValue<TType>
{
public static readonly TType Empty = From(string.Empty);

public static TType DefaultValue => Empty;

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace BUTR.Site.NexusMods.Server.Models;
public static readonly TType Bannerlord = From(TenantUtils.BannerlordId);
public static readonly TType Rimworld = From(TenantUtils.RimworldId);
public static readonly TType StardewValley = From(TenantUtils.StardewValleyId);

public static TType DefaultValue => None;

public static IEnumerable<TType> Values
Expand All @@ -25,7 +25,7 @@ public static IEnumerable<TType> Values
//yield return DarkestDungeon;
}
}

public static TType Copy(TType instance) => instance with { };
public static bool IsInitialized(TType instance) => instance._isInitialized;
public static TType DeserializeDangerous(TValueType instance) => Deserialize(instance);
Expand Down
22 changes: 13 additions & 9 deletions src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
global using BUTR.Site.NexusMods.Shared.Helpers;
global using BUTR.Site.NexusMods.Server.Models;
global using BUTR.Site.NexusMods.Server.ValueObjects.Utils;
global using BUTR.Site.NexusMods.Server.Utils;
global using Microsoft.Extensions.DependencyInjection;
global using BUTR.Site.NexusMods.Server.ValueObjects.Utils;
global using BUTR.Site.NexusMods.Shared.Helpers;

global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.ChangeTracking;
global using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
global using Microsoft.EntityFrameworkCore.Metadata.Builders;
global using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.OpenApi.Models;
global using Vogen;

global using Swashbuckle.AspNetCore.SwaggerGen;

global using System.ComponentModel;
global using System.Diagnostics.CodeAnalysis;
global using System.Globalization;
global using System.Reflection;
global using System.Runtime.CompilerServices;
global using System.Runtime.InteropServices;
global using System.Text.Json;
global using System.Text.Json.Serialization;
global using System.ComponentModel;
global using System.Globalization;
global using System.Reflection;
global using Swashbuckle.AspNetCore.SwaggerGen;

global using Vogen;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;

public interface IVogenParsable<TVogen, TValueObject>
where TVogen : IVogen<TVogen, TValueObject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;

public interface IVogenSpanParsable<TVogen, TValueObject>
where TVogen : IVogen<TVogen, TValueObject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;

public interface IVogenUtf8SpanParsable<TVogen, TValueObject>
where TVogen : IVogen<TVogen, TValueObject>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;
namespace BUTR.Site.NexusMods.Server.ValueObjects.Utils;

public sealed class VogenSchemaFilter : ISchemaFilter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace BUTR.Site.NexusMods.Server.Utils;
namespace BUTR.Site.NexusMods.Server.Utils;

public static class QueryableHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public AppDbContextRead(
IEntityConfigurationFactory entityConfigurationFactory,
DbContextOptions<AppDbContextRead> options) : base(dataSourceProvider, entityConfigurationFactory, options)
{

}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async ValueTask DisposeAsync()
}

private readonly ITenantContextAccessor _tenantContextAccessor;

private EntityFactory? _entityFactory;
private List<Func<Task>>? _onSave;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BUTR.Site.NexusMods.Server.Contexts.Configs;

public abstract class BaseEntityConfiguration<TEntity>: IEntityConfiguration where TEntity : class, IEntity
public abstract class BaseEntityConfiguration<TEntity> : IEntityConfiguration where TEntity : class, IEntity
{
public virtual void Configure(ModelBuilder builder) => ConfigureModel(builder.Entity<TEntity>());
protected virtual void ConfigureModel(EntityTypeBuilder<TEntity> builder) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace BUTR.Site.NexusMods.Server.Contexts.Configs;
namespace BUTR.Site.NexusMods.Server.Contexts.Configs;

public interface IEntityConfiguration;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using BUTR.Site.NexusMods.Server.Options;
using BUTR.Site.NexusMods.Server.Options;

using Microsoft.Extensions.Options;

Expand All @@ -12,15 +12,15 @@ public sealed class NpgsqlDataSourceProvider
{
private ConnectionStringsOptions _options;
private JsonSerializerOptions _jsonSerializerOptions;

private NpgsqlDataSource _main;
private NpgsqlDataSource _replica;

public NpgsqlDataSourceProvider(IOptionsMonitor<ConnectionStringsOptions> option, IOptionsMonitor<JsonSerializerOptions> jsonSerializerOptions)
{
_options = option.CurrentValue;
_jsonSerializerOptions = jsonSerializerOptions.CurrentValue;

option.OnChange(Listener1);
jsonSerializerOptions.OnChange(Listener2);

Expand All @@ -38,7 +38,7 @@ private void Rebuild()
.ConfigureJsonOptions(_jsonSerializerOptions)
.EnableDynamicJson()
.Build();

_replica = new NpgsqlDataSourceBuilder(_options.Replica)
.ConfigureJsonOptions(_jsonSerializerOptions)
.EnableDynamicJson()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static bool GetTypeLoadExceptionLevel(ExceptionModel? exceptionModel, ref int le
{
if (ct.IsCancellationRequested)
return false;

if (exceptionModel is null)
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/BUTR.Site.NexusMods.Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void ConfigureServices(IServiceCollection services)
services.TryAddEnumerable(ServiceDescriptor.Scoped(typeof(IEntityConfiguration), type));
foreach (var type in types.Where(x => x.BaseType!.GetGenericTypeDefinition() == typeof(BaseEntityConfiguration<>)))
services.TryAddEnumerable(ServiceDescriptor.Scoped(typeof(IEntityConfiguration), type));

services.AddSingleton<NpgsqlDataSourceProvider>();
services.AddDbContext<BaseAppDbContext>(ServiceLifetime.Scoped);
services.AddDbContextFactory<AppDbContextRead>(lifetime: ServiceLifetime.Scoped);
Expand Down

0 comments on commit 07dc589

Please sign in to comment.