(refactor): code fix and migrate to .net7

This commit is contained in:
Maksym Sadovnychyy 2022-11-25 00:06:32 +01:00
parent dcc37d0a3e
commit f274f96b4d
23 changed files with 25 additions and 25 deletions

View File

@ -27,15 +27,11 @@ public class UserDocument : DomainObjectDocumentBase<UserDocument> {
public Roles Role { get; set; } public Roles Role { get; set; }
public void SetPassword (string password) { public void SetPassword (string password) {
if (Passwords.Password != null)
Passwords.Expired.Add(Passwords.Password.Prototype());
Passwords.Password = new Password(password);
var old = Passwords.Password.Prototype();
} }
public override int GetHashCode() { public override int GetHashCode() {

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> <RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>

View File

@ -171,6 +171,8 @@ namespace ExtensionMethods {
public static DateTime ToDateTime(this string s, string[] formats) { public static DateTime ToDateTime(this string s, string[] formats) {
if (s == "Now") if (s == "Now")
return DateTime.Now; return DateTime.Now;
else if (s == "UtcNow")
return DateTime.UtcNow;
else if (s == "Today") else if (s == "Today")
return DateTime.Today; return DateTime.Today;

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> <RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>

View File

@ -1,7 +1,6 @@
using DomainObjects; using DomainObjects;
using DataProviders.Collections; using DataProviders.Collections;
using DomainResults.Mvc; using DomainResults.Mvc;
using ExtensionMethods;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Models.Account.Requests; using WeatherForecast.Models.Account.Requests;
@ -85,7 +84,6 @@ public class AccountController : ControllerBase {
} }
#endregion #endregion
/// <summary> /// <summary>
/// For authenticated users that want to change their password the PUT request can be performed immediately without the email /// For authenticated users that want to change their password the PUT request can be performed immediately without the email
/// (the account for which we are updating the password is known to the server). In such case the form will submit two fields /// (the account for which we are updating the password is known to the server). In such case the form will submit two fields
@ -109,5 +107,4 @@ public class AccountController : ControllerBase {
return Unauthorized(); return Unauthorized();
} }
} }

View File

@ -1,4 +1,4 @@
using Core.DomainObjects.Documents; using DomainObjects.Documents;
using Core.Enumerations; using Core.Enumerations;
using Extensions; using Extensions;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using Core.Enumerations; using Core.Enumerations;
using DataProviders.Collections; using DataProviders.Collections;
using DomainObjects.Enumerations;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using WeatherForecast.Policies.Abstractions; using WeatherForecast.Policies.Abstractions;
using WeatherForecast.Services; using WeatherForecast.Services;

View File

@ -1,6 +1,7 @@
using Core.Enumerations; using Core.Enumerations;
using DataProviders; using DataProviders;
using DataProviders.Collections; using DataProviders.Collections;
using DomainObjects.Enumerations;
using FileSecurityService; using FileSecurityService;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using WeatherForecast.Policies.Abstractions; using WeatherForecast.Policies.Abstractions;

View File

@ -6,6 +6,7 @@ using DataProviders.Collections;
using WeatherForecast.Models.Responses; using WeatherForecast.Models.Responses;
using WeatherForecast.Models.Blog.Responses; using WeatherForecast.Models.Blog.Responses;
using DomainObjects.Enumerations;
namespace WeatherForecast.Services { namespace WeatherForecast.Services {

View File

@ -7,6 +7,7 @@ using Core.Abstractions;
using WeatherForecast.Models.Category.Requests; using WeatherForecast.Models.Category.Requests;
using WeatherForecast.Models.Category.Responses; using WeatherForecast.Models.Category.Responses;
using DomainObjects.Enumerations;
namespace WeatherForecast.Services { namespace WeatherForecast.Services {

View File

@ -7,6 +7,7 @@ using Core.Enumerations;
using WeatherForecast.Models.Responses; using WeatherForecast.Models.Responses;
using WeatherForecast.Models.Category.Responses; using WeatherForecast.Models.Category.Responses;
using DomainObjects.Enumerations;
namespace WeatherForecast.Services { namespace WeatherForecast.Services {

View File

@ -8,6 +8,7 @@ using Core.Enumerations;
using WeatherForecast.Models; using WeatherForecast.Models;
using WeatherForecast.Models.Responses; using WeatherForecast.Models.Responses;
using WeatherForecast.Models.Shop.Responses; using WeatherForecast.Models.Shop.Responses;
using DomainObjects.Enumerations;
namespace WeatherForecast.Services { namespace WeatherForecast.Services {

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>WeatherForecast</RootNamespace> <RootNamespace>WeatherForecast</RootNamespace>