Skip to content

Commit a4802b2

Browse files
authored
fix: typo LoaDatabaseValues (#608)
* fix: typo * fix: typo in fix of typo * chore: enable sql logging in JsonApiDotNetCoreExample
1 parent 5733fe5 commit a4802b2

File tree

8 files changed

+17
-9
lines changed

8 files changed

+17
-9
lines changed

src/Examples/JsonApiDotNetCoreExample/Startups/ClientGeneratedIdsStartup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override void ConfigureServices(IServiceCollection services)
3434
options.DefaultPageSize = 5;
3535
options.IncludeTotalRecordCount = true;
3636
options.EnableResourceHooks = true;
37-
options.LoaDatabaseValues = true;
37+
options.LoadDatabaseValues = true;
3838
options.AllowClientGeneratedIds = true;
3939
},
4040
discovery => discovery.AddAssembly(Assembly.Load(nameof(JsonApiDotNetCoreExample))),

src/Examples/JsonApiDotNetCoreExample/Startups/NoDefaultPageSizeStartup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override void ConfigureServices(IServiceCollection services)
3333
options.Namespace = "api/v1";
3434
options.IncludeTotalRecordCount = true;
3535
options.EnableResourceHooks = true;
36-
options.LoaDatabaseValues = true;
36+
options.LoadDatabaseValues = true;
3737
options.AllowClientGeneratedIds = true;
3838
},
3939
discovery => discovery.AddAssembly(Assembly.Load(nameof(JsonApiDotNetCoreExample))),

src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
using Microsoft.EntityFrameworkCore;
88
using JsonApiDotNetCore.Extensions;
99
using System;
10+
using Microsoft.Extensions.Logging.Console;
11+
using Microsoft.Extensions.Logging.Debug;
1012

1113
namespace JsonApiDotNetCoreExample
1214
{
@@ -24,6 +26,7 @@ public Startup(IWebHostEnvironment env)
2426
Config = builder.Build();
2527
}
2628

29+
2730
public virtual void ConfigureServices(IServiceCollection services)
2831
{
2932
var loggerFactory = new LoggerFactory();
@@ -36,15 +39,17 @@ public virtual void ConfigureServices(IServiceCollection services)
3639
})
3740
.AddDbContext<AppDbContext>(options =>
3841
{
39-
options.UseNpgsql(GetDbConnectionString(), options => options.SetPostgresVersion(new Version(9,6)));
42+
options.UseLoggerFactory(new LoggerFactory(new[] { new DebugLoggerProvider() }))
43+
.EnableSensitiveDataLogging()
44+
.UseNpgsql(GetDbConnectionString(), options => options.SetPostgresVersion(new Version(9,6)));
4045
}, ServiceLifetime.Transient)
4146
.AddJsonApi(options =>
4247
{
4348
options.Namespace = "api/v1";
4449
options.DefaultPageSize = 5;
4550
options.IncludeTotalRecordCount = true;
4651
options.EnableResourceHooks = true;
47-
options.LoaDatabaseValues = true;
52+
options.LoadDatabaseValues = true;
4853
},
4954
discovery => discovery.AddCurrentAssembly());
5055
services.AddClientSerialization();

src/Examples/JsonApiDotNetCoreExample/appsettings.json

100755100644
+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"LogLevel": {
88
"Default": "Warning",
99
"System": "Warning",
10-
"Microsoft": "Warning"
10+
"Microsoft": "Warning",
11+
"LogLevel": {
12+
"Microsoft.EntityFrameworkCore": "Debug"
13+
}
1114
}
1215
}
1316
}

src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public interface IJsonApiOptions : ILinksConfiguration, ISerializerOptions
88
///
99
/// Defaults to <see langword="false"/>.
1010
/// </summary>
11-
bool LoaDatabaseValues { get; set; }
11+
bool LoadDatabaseValues { get; set; }
1212
/// <summary>
1313
/// Whether or not the total-record count should be included in all document
1414
/// level meta objects.

src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class JsonApiOptions : IJsonApiOptions
5252
///
5353
/// Defaults to <see langword="false"/>.
5454
/// </summary>
55-
public bool LoaDatabaseValues { get; set; } = false;
55+
public bool LoadDatabaseValues { get; set; } = false;
5656

5757
/// <summary>
5858
/// The base URL Namespace

src/JsonApiDotNetCore/Hooks/Execution/HookExecutorHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public bool ShouldLoadDbValues(Type entityType, ResourceHook hook)
102102
return false;
103103
if (discovery.DatabaseValuesEnabledHooks.Contains(hook))
104104
return true;
105-
return _options.LoaDatabaseValues;
105+
return _options.LoadDatabaseValues;
106106
}
107107

108108
bool ShouldExecuteHook(RightType entityType, ResourceHook hook)

test/UnitTests/ResourceHooks/ResourceHooksTestsSetup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public class HooksTestsSetup : HooksDummyData
145145
var pfMock = new Mock<IGenericServiceFactory>();
146146
var ufMock = new Mock<ITargetedFields>();
147147
var iqsMock = new Mock<IIncludeService>();
148-
var optionsMock = new JsonApiOptions { LoaDatabaseValues = false };
148+
var optionsMock = new JsonApiOptions { LoadDatabaseValues = false };
149149
return (ufMock, iqsMock, pfMock, optionsMock);
150150
}
151151

0 commit comments

Comments
 (0)