Update project for multi-targeting and nullable types

Updated `DigitalData.UserManager.Domain.csproj` to support .NET 4.6.2, 7.0, 8.0, and 9.0. Adjusted implicit usings and nullable reference types settings based on the target framework, disabling nullable types for `net462` and enabling them for others.

Refactored entity classes (`BaseEntity`, `ClientUser`, `Group`, `GroupOfUser`, `Module`, `ModuleOfUser`, `User`, and `UserRep`) to conditionally include nullable reference types. Added `?` operator for string properties in .NET 7.0 and above, enhancing code safety and reducing null reference exceptions.
This commit is contained in:
2025-06-26 13:15:36 +02:00
parent b1075c8b82
commit bc44de63ee
9 changed files with 28 additions and 28 deletions

View File

@@ -22,7 +22,7 @@ namespace DigitalData.UserManager.Domain.Entities
[Column("COMMENT")]
[StringLength(200)]
public string
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
?
#endif
Comment { get; set; }
@@ -30,7 +30,7 @@ namespace DigitalData.UserManager.Domain.Entities
[Column("ADDED_WHO")]
[StringLength(50)]
public string
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
?
#endif
AddedWho { get; set; } = "DEFAULT";
@@ -38,21 +38,21 @@ namespace DigitalData.UserManager.Domain.Entities
[Column("CHANGED_WHO")]
[StringLength(50)]
public string
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
?
#endif
ChangedWho { get; set; }
[ForeignKey("UserId")]
public virtual User
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
?
#endif
User { get; set; }
[ForeignKey("ModuleId")]
public virtual Module
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
?
#endif
Module { get; set; }