Refactor entity properties for nullability and requirements

Removed nullable indicators from string properties in
BaseEntity.cs, ClientUser.cs, Group.cs, and User.cs.
The Username property in User.cs is now marked as
required for .NET 7 or greater, improving data integrity
and reducing null reference risks.
This commit is contained in:
tekh 2025-06-26 13:20:54 +02:00
parent bc44de63ee
commit 5d3f73bb13
4 changed files with 10 additions and 11 deletions

View File

@ -20,8 +20,7 @@ namespace DigitalData.UserManager.Domain.Entities
#if NET7_0_OR_GREATER
?
#endif
AddedWho
{ get; set; }
AddedWho { get; set; }
[StringLength(50)]
[Column("CHANGED_WHO")]
@ -29,8 +28,7 @@ namespace DigitalData.UserManager.Domain.Entities
#if NET7_0_OR_GREATER
?
#endif
ChangedWho
{ get; set; }
ChangedWho { get; set; }
//TODO: assign it to default value in create dto, not here!
[Column("ADDED_WHEN", TypeName = "datetime")]

View File

@ -28,8 +28,7 @@ namespace DigitalData.UserManager.Domain.Entities
#if NET7_0_OR_GREATER
?
#endif
Comment
{ get; set; }
Comment { get; set; }
[StringLength(50)]
[Column("ADDED_WHO")]
@ -37,8 +36,7 @@ namespace DigitalData.UserManager.Domain.Entities
#if NET7_0_OR_GREATER
?
#endif
AddedWho
{ get; set; }
AddedWho { get; set; }
[Column("ADDED_WHEN", TypeName = "datetime")]
[DefaultValue("GETDATE()")]

View File

@ -32,8 +32,7 @@ namespace DigitalData.UserManager.Domain.Entities
#if NET7_0_OR_GREATER
?
#endif
Comment
{ get; set; }
Comment { get; set; }
// TODO: this column should be assigned by triggers. despite this it is not null and this is problem for creation. talk with others
[Required]

View File

@ -26,7 +26,11 @@ namespace DigitalData.UserManager.Domain.Entities
[Required]
[Column("USERNAME")]
[StringLength(50)]
public string Username { get; set; }
public
#if NET7_0_OR_GREATER
required
#endif
string Username { get; set; }
[Column("SHORTNAME")]
[StringLength(30)]