Skip to content

Commit

Permalink
Preview 4.3 (#250)
Browse files Browse the repository at this point in the history
* Update MasterData dependencies

* Fix test compile

* Use `DbType.AnsiString` instead of `DbType.String`

* `DbType.AnsiString` correct handling

* `GetDataType`

* Add `BootstrapColor.Info` conditional at `MessageToastFactory`

* Performance: Unnecessary `async` keyword

* Remove unnecessary `FormContext` class for easier debug.

* bugfix: Insert selection not using inserted values after the operation is finished

* Reload the entire form after DataImportation

* Remove unnecessary class

* Optimize `IconHelper` by using static ctor

* Use `ValueTask<FormElement>` at `GetFormElementAsync` to show the intent that `FormElement` is cached.

* Update ConnectionString name nullability

* Use `const` instead of variable

* Fix warning as error at Test project

* Pagination UI

* bugfix: 1xn relationships at Edit mode

* Optimize LINQ methods

* Use ViaCEP

* CEP fixes

* Fix date formatting

* Remove unnecessary method

* Improve debug and performance by loading actions only one time

* DataPanel secret values

* bugfix: Cache not working as intented at Brasil plugin

* Fix Brasil plugin

* Fix `FieldFormattingService` with Guid (case-insensitive) values

* Append SecretValues only if Any

* Fix existing secret values

* bugfix error handling at insert selection

* Update NCalc to 4.3.3, remove unnecessary `FieldsService` and use `ValueTask` at expressions

* Update .csproj

* Fix `isAtRelationship` at `GetSaveActionResult`

* Optimize empty result

* Use `TryGetValue`

* Move actions to right

* Remove redundant casts at solution

* Add ConnectionId support to DbLogger

* Create "val" constant and small refactor.

* Use submit at InternalRedirect

* bugfix: Use submit instead of requestSubmit to work on complex forms

* Update jjmasterdata.js.map

* Trim value at `FieldFormattingService`

* bugfix: Trim searchid

* Better readability

* bugfix: InternalRedirectController was not saving files

* Update NCalc to v5

* Remove old NCalc bug from docs

* Add default options

* Remove null values from secret values

* Add `Name` property to CollapsePanelTagHelper.cs and small refactors

* Add better exception if SQL is null or empty

* Change JJAlert font-size

* GetTitle is no longer async

* bugfix: `JJModalDialog` missing fade animation

* Html template action (#253)

* Added HtmlTemplateAction.cs

* Rendering HtmlTemplateAction

* HTML templace action iframe

* Added Fluid support

* l10n and service

* ShowAsButton default value false

* Change to print

* Revert unintented change

* Remove unused method

* bug fixes

* NCalc is now used by default

* Added `localizer` function to Fluid

* Rename variable

* Optimize BootstrapHelper by evaluating only once

* Ignore case at GridFilter.cs

* Session is essential

* Fix JJAlert layout when Title is null or empty

* Remove unused using directives

* bugfix: ASP.NET Core mvc `TempData` not working

* Update session cookie

* UrlRedirect now have {AppPath} variable

* `UrlRedirectService`

* Fix {AppPath}

* Code style and use `ValueTask` at controls and factories (rarely async code)

* bugfix: Grid Actions not working at insert selection

* Remove NCalc from example

* Use `ValueTask` in places where the method run more `sync` than `async` (#251)

* Use `ValueTask` instead of `Task` at event handlers

* Use `ValueTask` where the method result is normally cached

* Added `GridOnDataLoadEventHandler` because this event is always `async`

* Merge with preview

* Update custom_rules.md

* Update NCalc to 5.2 and add `ConnectionId` by default at expressions

* <EnableNETAnalyzers>true</EnableNETAnalyzers>

* Add Roslynator code analyzer

* `IDisposable` warnings

* Code style

* Add `MustDisposeResource` annotation

* Update Jetbrains.Annotations

* Code style

* Performance: Roslynator analyzers

* Fix WebApi error

* Rename system cookies

* Fix localize function

* Remove cache from Brasil services

* HubDev fix

* Code style

* Fix l10n for Unix systems

* bugfix at `FieldFormattingService`

* Code style

* Code style

* Code style

* Added url redirect support to SqlCommandAction

* Fix GridView.cs

* BugFix: Decimal places

* rollback

* Change default number of the items returned on SearchBox from 10 to 30

* bugfix to build

* 4.3.0-preview1

* release candidate 4.3.0.0

* removed NCalc Plugin

* Ajustes para rodar no mac mobile

* cors

* changed number Of Items from searchbox to 30 as default

* upd MD

* BugFix: In the insert, when you enable the element to select and use this same dictionary as a view relationship, it appears as a list. The error was generated in commit f4a9441

* Rider 2024.2 suggestions

* Use `char` at StringBuilder

* Roslynator

* Code style

* Small refactors

* Fix plugin action with relationships

* Performance improvements

* Simplify with TryGetValue

* bugfix: Insert selection executing back action after a record is selected

* Improve LoggerDecoration.cs

* Improve LoggerDecoration.cs

* Read PageState from QueryString

* Fix CA1853

* Code style

* Fix pageState query string at relationships

* Optimize OrderByData.cs

* Fix insert logic

* Code style

* Code style

* Fix Insert logic

* Improve form logic using TryGetValue

* Allow Fluid functions at Grid template

---------

Co-authored-by: Lucio Pelinson <[email protected]>
  • Loading branch information
gumbarros and LucioPelinson authored Aug 28, 2024
1 parent 5ee6e2e commit e8febbf
Show file tree
Hide file tree
Showing 389 changed files with 4,008 additions and 3,868 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
[*.cs]


dotnet_diagnostic.CA1841.severity = error

# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none

dotnet_diagnostic.RCS1194.severity = none
dotnet_diagnostic.RCS1139.severity = none
dotnet_diagnostic.RCS1015.severity = error
dotnet_diagnostic.RCS1077.severity = error
dotnet_diagnostic.RCS1080.severity = error
dotnet_diagnostic.RCS1105.severity = error
dotnet_diagnostic.RCS1112.severity = error
dotnet_diagnostic.RCS1156.severity = error
1 change: 0 additions & 1 deletion .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
- src/WebApi
- src/Plugins/Hangfire
- src/Plugins/Pdf
- src/Plugins/NCalc
steps:
- uses: actions/checkout@v2
- name: Build and publish NuGet package
Expand Down
11 changes: 9 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<PackageProjectUrl>https://www.github.com/JJConsulting/JJMasterData</PackageProjectUrl>
<RepositoryUrl>https://www.github.com/JJConsulting/JJMasterData</RepositoryUrl>
<PackageIcon>JJMasterData.png</PackageIcon>
<Version>4.2.6</Version>
<Version>4.3.0</Version>
<PackageReadmeFile>README.NuGet.md</PackageReadmeFile>
<PackageVersion>$(Version)</PackageVersion>
<PackageVersion>$(Version).0-rc</PackageVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
<IncludeSymbols>true</IncludeSymbols>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<WarningsAsErrors>CA1859;CS4014</WarningsAsErrors>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<FileVersion>$(Version)</FileVersion>
Expand All @@ -30,5 +31,11 @@
<PackagePath>/</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4"/>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.4"/>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.12.4"/>
</ItemGroup>
</Project>

30 changes: 0 additions & 30 deletions JJMasterData.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{6DF8173F
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Test", "test\Core.Test\Core.Test.csproj", "{CAB8385E-033D-4D3B-A7F2-6F024AAB8527}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web.Test", "test\Web.Test\Web.Test.csproj", "{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commons.Test", "test\Commons.Test\Commons.Test.csproj", "{14C3076E-B624-4F3B-A4A6-D091577937A1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{86CDB147-0DAF-4493-BAAA-277D13A85DB8}"
Expand Down Expand Up @@ -73,8 +71,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "src\Core\Core.cspro
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Brasil.Test", "test\Plugins\Brasil\Brasil.Test\Brasil.Test.csproj", "{475FAD96-EB34-4761-B551-8DC0100A592A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NCalc", "src\Plugins\NCalc\NCalc.csproj", "{FDF54236-3662-4C89-B49D-5700C64C4B8D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchemaGenerator", "src\ConsoleApps\SchemaGenerator\SchemaGenerator.csproj", "{29388C67-8C15-4EAE-836C-15BA812846F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormElementImporter", "src\ConsoleApps\FormElementImporter\FormElementImporter.csproj", "{8FB84AE3-4FBC-492F-B3BE-4B7000CEDFE1}"
Expand Down Expand Up @@ -187,18 +183,6 @@ Global
{CAB8385E-033D-4D3B-A7F2-6F024AAB8527}.Release|x64.Build.0 = Release|Any CPU
{CAB8385E-033D-4D3B-A7F2-6F024AAB8527}.Release|x86.ActiveCfg = Release|Any CPU
{CAB8385E-033D-4D3B-A7F2-6F024AAB8527}.Release|x86.Build.0 = Release|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Debug|x64.ActiveCfg = Debug|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Debug|x64.Build.0 = Debug|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Debug|x86.ActiveCfg = Debug|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Debug|x86.Build.0 = Debug|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Release|Any CPU.Build.0 = Release|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Release|x64.ActiveCfg = Release|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Release|x64.Build.0 = Release|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Release|x86.ActiveCfg = Release|Any CPU
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737}.Release|x86.Build.0 = Release|Any CPU
{14C3076E-B624-4F3B-A4A6-D091577937A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14C3076E-B624-4F3B-A4A6-D091577937A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14C3076E-B624-4F3B-A4A6-D091577937A1}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -307,18 +291,6 @@ Global
{475FAD96-EB34-4761-B551-8DC0100A592A}.Release|x64.Build.0 = Release|Any CPU
{475FAD96-EB34-4761-B551-8DC0100A592A}.Release|x86.ActiveCfg = Release|Any CPU
{475FAD96-EB34-4761-B551-8DC0100A592A}.Release|x86.Build.0 = Release|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Debug|x64.ActiveCfg = Debug|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Debug|x64.Build.0 = Debug|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Debug|x86.ActiveCfg = Debug|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Debug|x86.Build.0 = Debug|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Release|Any CPU.Build.0 = Release|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Release|x64.ActiveCfg = Release|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Release|x64.Build.0 = Release|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Release|x86.ActiveCfg = Release|Any CPU
{FDF54236-3662-4C89-B49D-5700C64C4B8D}.Release|x86.Build.0 = Release|Any CPU
{29388C67-8C15-4EAE-836C-15BA812846F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29388C67-8C15-4EAE-836C-15BA812846F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29388C67-8C15-4EAE-836C-15BA812846F7}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -368,14 +340,12 @@ Global
{CD6DDE10-3DC3-4D42-BA45-9999E995F39A} = {59427CF1-D6B7-4779-9E62-4717C5763762}
{40C11852-04ED-413B-9FED-C9666D62B0A2} = {59427CF1-D6B7-4779-9E62-4717C5763762}
{CAB8385E-033D-4D3B-A7F2-6F024AAB8527} = {6DF8173F-DE7A-4110-B192-856C0CD48D37}
{85B7C6A1-9901-4CB4-BCE9-D60F9C257737} = {6DF8173F-DE7A-4110-B192-856C0CD48D37}
{14C3076E-B624-4F3B-A4A6-D091577937A1} = {6DF8173F-DE7A-4110-B192-856C0CD48D37}
{F3309B09-66B6-41DC-9624-DE50F6600CF1} = {59427CF1-D6B7-4779-9E62-4717C5763762}
{98258DC9-8941-48AA-A5B8-4266CE09AA59} = {6DF8173F-DE7A-4110-B192-856C0CD48D37}
{62CAAFCD-1856-417A-A23F-92A332B67236} = {59427CF1-D6B7-4779-9E62-4717C5763762}
{13EC3E0B-2540-4210-B816-26F57865891B} = {6DF8173F-DE7A-4110-B192-856C0CD48D37}
{475FAD96-EB34-4761-B551-8DC0100A592A} = {98258DC9-8941-48AA-A5B8-4266CE09AA59}
{FDF54236-3662-4C89-B49D-5700C64C4B8D} = {59427CF1-D6B7-4779-9E62-4717C5763762}
{29388C67-8C15-4EAE-836C-15BA812846F7} = {8799DF37-58EB-4B95-A558-DD3D5EDD247A}
{8FB84AE3-4FBC-492F-B3BE-4B7000CEDFE1} = {8799DF37-58EB-4B95-A558-DD3D5EDD247A}
{5325D0BE-1C2F-4A5E-8A30-8A443DE17C53} = {8799DF37-58EB-4B95-A558-DD3D5EDD247A}
Expand Down
4 changes: 2 additions & 2 deletions doc/Documentation/articles/custom_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AgendamentoStatusFormEventHandler : FormEventHandlerBase
private const string IconeFieldName = "Icone";
public override string ElementName => "AgendamentoStatus";

public override Task OnFormElementLoadAsync(object sender, FormElementLoadEventArgs args)
public override ValueTask OnFormElementLoadAsync(object sender, FormElementLoadEventArgs args)
{
var formElement = args.FormElement;
var iconField = formElement.Fields[IconeFieldName];
Expand All @@ -54,7 +54,7 @@ public class AgendamentoStatusFormEventHandler : FormEventHandlerBase
});
}

return Task.CompletedTask;
return ValueTask.CompletedTask;
}
}
```
Expand Down
23 changes: 21 additions & 2 deletions doc/Documentation/articles/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In the Data Dictionary UI, the expression editor is simplified like this:

## What are the default expression providers?
- Type [val:] returns a value; (1 or 0) (true or false) ("foo") etc..
- Type [exp:] returns the result of the expression from `DataTable.Compute`;
- Type [exp:] returns the result of the expression from [NCalc](https://github.com/ncalc/ncalc);
- Type [sql:] returns the result of a sql command;

> [!TIP]
Expand Down Expand Up @@ -105,4 +105,23 @@ At your `Program.cs` simply:
builder.Services.AddJJMasterDataWeb().WithExpressionProvider<TMyCustomProvider>();
```

[!include[Readme](../../../src/Plugins/NCalc/README.MD)]
## Executing C# code at your expressions
You can execute C# code using the following example;

Program.cs:
```
builder.Services.PostConfigure<MasterDataCoreOptions>(options =>
{
options.ExpressionsContext.Functions = new Dictionary<string, ExpressionFunction>
{
{"now", _ => DateTime.Now},
{"myAwesomeFunction", args => MyCustomClass.Execute(args[0], args[1])}
}.ToFrozenDictionary()
});
```

At your expression:
```
exp: myAwesomeFunction('{StringValue}',{IntValue})
```
1 change: 0 additions & 1 deletion doc/Documentation/articles/plugins/ncalc.md

This file was deleted.

2 changes: 0 additions & 2 deletions doc/Documentation/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
href: plugins/mongodb.md
- name: Python
href: plugins/python.md
- name: NCalc
href: plugins/ncalc.md
- name: Miscellaneous
items:
- name: Multiple Forms Support
Expand Down
8 changes: 1 addition & 7 deletions example/WebEntryPoint/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// This is a debug and example purposes Program.cs

using System.Globalization;
using JJMasterData.Core.Configuration;
using JJMasterData.NCalc.Configuration;
using JJMasterData.Web.Configuration;
using Microsoft.AspNetCore.ResponseCompression;
using JJMasterData.Pdf;
Expand All @@ -25,10 +22,7 @@
options.BackgroundServiceExceptionBehavior =
BackgroundServiceExceptionBehavior.Ignore;
});
builder.Services.AddJJMasterDataWeb(builder.Configuration).WithNCalcExpressionProvider(new()
{
ReplaceDefaultExpressionProvider = true
}).WithPdfExportation();
builder.Services.AddJJMasterDataWeb(builder.Configuration).WithPdfExportation();

var app = builder.Build();

Expand Down
1 change: 0 additions & 1 deletion example/WebEntryPoint/WebEntryPoint.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Core\Core.csproj" />
<ProjectReference Include="..\..\src\Plugins\Brasil\Brasil.csproj" />
<ProjectReference Include="..\..\src\Plugins\NCalc\NCalc.csproj" />
<ProjectReference Include="..\..\src\Plugins\Pdf\Pdf.csproj" />
<ProjectReference Include="..\..\src\Web\Web.csproj" />
</ItemGroup>
Expand Down
23 changes: 13 additions & 10 deletions src/Commons/Commons.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="6.0.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="PolySharp" Version="1.13.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.Diagnostics.EventLog" Version="6.0.0" />
<PackageReference Include="System.Threading.Channels" Version="7.0.0" />
<PackageReference Include="System.Diagnostics.EventLog" Version="8.0.0" />
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="JJMasterData.Commons.Test" />
Expand Down
2 changes: 0 additions & 2 deletions src/Commons/Configuration/MasterDataServiceBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using JJMasterData.Commons.Configuration.Options;
using JJMasterData.Commons.Data;
using JJMasterData.Commons.Data.Entity.Models;
using JJMasterData.Commons.Data.Entity.Providers;
using JJMasterData.Commons.Data.Entity.Repository.Abstractions;
using JJMasterData.Commons.Tasks;
Expand Down
2 changes: 1 addition & 1 deletion src/Commons/Configuration/Options/ConnectionString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public ConnectionString(string connectionString, string connectionProvider) : th
}

public Guid Guid { get; init; } = Guid.NewGuid();
public string? Name { get; init; }
public string Name { get; init; } = null!;
public string Connection { get; init; } = null!;
public string ConnectionProvider { get; init; } = null!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ConnectionString GetConnectionString(Guid? guid)
if (guid is null)
return new ConnectionString(ConnectionString!, ConnectionProvider.GetAdoNetTypeName());

var connectionString = AdditionalConnectionStrings.FirstOrDefault(c => c.Guid == guid);
var connectionString = AdditionalConnectionStrings.Find(c => c.Guid == guid);

if (connectionString is null)
throw new JJMasterDataException($"ConnectionString {guid} does not exist.");
Expand Down
4 changes: 2 additions & 2 deletions src/Commons/Configuration/Options/WritableJsonOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public async Task UpdateAsync(Action<T> applyChanges)

private PropertyInfo[] GetCachedProperties(Type type)
{
if (memoryCache.TryGetValue(type, out PropertyInfo[] cachedProperties))
if (memoryCache.TryGetValue(type, out PropertyInfo[]? cachedProperties))
{
return cachedProperties;
return cachedProperties!;
}

var properties = type.GetProperties();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.IO;
using System.Linq;
using JJMasterData.Commons.Configuration.Options.Abstractions;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
Expand Down
Loading

0 comments on commit e8febbf

Please sign in to comment.