Skip to content

fix: typo LoaDatabaseValues #608

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

Merged
merged 3 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void ConfigureServices(IServiceCollection services)
options.DefaultPageSize = 5;
options.IncludeTotalRecordCount = true;
options.EnableResourceHooks = true;
options.LoaDatabaseValues = true;
options.LoadDatabaseValues = true;
options.AllowClientGeneratedIds = true;
},
discovery => discovery.AddAssembly(Assembly.Load(nameof(JsonApiDotNetCoreExample))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override void ConfigureServices(IServiceCollection services)
options.Namespace = "api/v1";
options.IncludeTotalRecordCount = true;
options.EnableResourceHooks = true;
options.LoaDatabaseValues = true;
options.LoadDatabaseValues = true;
options.AllowClientGeneratedIds = true;
},
discovery => discovery.AddAssembly(Assembly.Load(nameof(JsonApiDotNetCoreExample))),
Expand Down
9 changes: 7 additions & 2 deletions src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Microsoft.EntityFrameworkCore;
using JsonApiDotNetCore.Extensions;
using System;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Logging.Debug;

namespace JsonApiDotNetCoreExample
{
Expand All @@ -24,6 +26,7 @@ public Startup(IWebHostEnvironment env)
Config = builder.Build();
}


public virtual void ConfigureServices(IServiceCollection services)
{
var loggerFactory = new LoggerFactory();
Expand All @@ -36,15 +39,17 @@ public virtual void ConfigureServices(IServiceCollection services)
})
.AddDbContext<AppDbContext>(options =>
{
options.UseNpgsql(GetDbConnectionString(), options => options.SetPostgresVersion(new Version(9,6)));
options.UseLoggerFactory(new LoggerFactory(new[] { new DebugLoggerProvider() }))
.EnableSensitiveDataLogging()
.UseNpgsql(GetDbConnectionString(), options => options.SetPostgresVersion(new Version(9,6)));
}, ServiceLifetime.Transient)
.AddJsonApi(options =>
{
options.Namespace = "api/v1";
options.DefaultPageSize = 5;
options.IncludeTotalRecordCount = true;
options.EnableResourceHooks = true;
options.LoaDatabaseValues = true;
options.LoadDatabaseValues = true;
},
discovery => discovery.AddCurrentAssembly());
services.AddClientSerialization();
Expand Down
5 changes: 4 additions & 1 deletion src/Examples/JsonApiDotNetCoreExample/appsettings.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"LogLevel": {
"Default": "Warning",
"System": "Warning",
"Microsoft": "Warning"
"Microsoft": "Warning",
"LogLevel": {
"Microsoft.EntityFrameworkCore": "Debug"
}
}
}
}
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface IJsonApiOptions : ILinksConfiguration, ISerializerOptions
///
/// Defaults to <see langword="false"/>.
/// </summary>
bool LoaDatabaseValues { get; set; }
bool LoadDatabaseValues { get; set; }
/// <summary>
/// Whether or not the total-record count should be included in all document
/// level meta objects.
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiDotNetCore/Configuration/JsonApiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class JsonApiOptions : IJsonApiOptions
///
/// Defaults to <see langword="false"/>.
/// </summary>
public bool LoaDatabaseValues { get; set; } = false;
public bool LoadDatabaseValues { get; set; } = false;

/// <summary>
/// The base URL Namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public bool ShouldLoadDbValues(Type entityType, ResourceHook hook)
return false;
if (discovery.DatabaseValuesEnabledHooks.Contains(hook))
return true;
return _options.LoaDatabaseValues;
return _options.LoadDatabaseValues;
}

bool ShouldExecuteHook(RightType entityType, ResourceHook hook)
Expand Down
2 changes: 1 addition & 1 deletion test/UnitTests/ResourceHooks/ResourceHooksTestsSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public class HooksTestsSetup : HooksDummyData
var pfMock = new Mock<IGenericServiceFactory>();
var ufMock = new Mock<ITargetedFields>();
var iqsMock = new Mock<IIncludeService>();
var optionsMock = new JsonApiOptions { LoaDatabaseValues = false };
var optionsMock = new JsonApiOptions { LoadDatabaseValues = false };
return (ufMock, iqsMock, pfMock, optionsMock);
}

Expand Down