Refactor using directives and add User entity

- Updated `using` directives in `Config.cs` and `EnvelopeType.cs` to include additional namespaces and removed `DigitalData.Core.Abstractions`.
- Adjusted formatting for `StatusName` and `IsAlreadySent` properties in `Envelope.cs` for consistency.
- Simplified `User` property in `Envelope.cs` by removing the namespace prefix.
- Introduced a new `User` class in `User.cs` with various properties and data annotations for database mapping.
- Removed the `<Nullable>` property from `EnvelopeGenerator.Domain.csproj`, which may impact nullability handling.
This commit is contained in:
Developer 02 2025-05-16 09:56:44 +02:00
parent 1a69478f48
commit bdf2527fc1
5 changed files with 101 additions and 8 deletions

View File

@ -1,5 +1,4 @@
using DigitalData.Core.Abstractions; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;

View File

@ -92,7 +92,7 @@ namespace EnvelopeGenerator.Domain.Entities
/// The sender of envelope /// The sender of envelope
/// </summary> /// </summary>
[ForeignKey("UserId")] [ForeignKey("UserId")]
public DigitalData.UserManager.Domain.Entities.User User { get; set; } public User User { get; set; }
[ForeignKey("EnvelopeTypeId")] [ForeignKey("EnvelopeTypeId")]
public EnvelopeType EnvelopeType { get; set; } public EnvelopeType EnvelopeType { get; set; }
@ -101,7 +101,7 @@ namespace EnvelopeGenerator.Domain.Entities
public string EnvelopeTypeTitle => EnvelopeType.Title; public string EnvelopeTypeTitle => EnvelopeType.Title;
[NotMapped] [NotMapped]
public bool IsAlreadySent => Status > (int) Constants.EnvelopeStatus.EnvelopeSaved; public bool IsAlreadySent => Status > (int)Constants.EnvelopeStatus.EnvelopeSaved;
public IEnumerable<EnvelopeDocument> Documents { get; set; } public IEnumerable<EnvelopeDocument> Documents { get; set; }

View File

@ -1,5 +1,4 @@
using DigitalData.Core.Abstractions; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities

View File

@ -0,0 +1,96 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBDD_USER", Schema = "dbo")]
public class User
{
[Column("GUID")]
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(50)]
[Column("ADDED_WHO")]
public string AddedWho { get; set; }
[StringLength(50)]
[Column("CHANGED_WHO")]
public string ChangedWho { get; set; }
//TODO: assign it to default value in create dto, not here!
[Column("ADDED_WHEN", TypeName = "datetime")]
[DefaultValue("GETDATE()")]
public DateTime AddedWhen { get; set; } = DateTime.Now;
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime ChangedWhen { get; set; }
[Column("PRENAME")]
[StringLength(50)]
public string Prename { get; set; }
[Column("NAME")]
[StringLength(50)]
public string Name { get; set; }
[Required]
[Column("USERNAME")]
[StringLength(50)]
public string Username { get; set; }
[Column("SHORTNAME")]
[StringLength(30)]
public string Shortname { get; set; }
[Column("EMAIL")]
[StringLength(100)]
public string Email { get; set; }
[Required]
[Column("LANGUAGE")]
[StringLength(5)]
[DefaultValue("de-DE")]
public string Language { get; set; }
[Column("COMMENT")]
[StringLength(500)]
public string Comment { get; set; }
[Column("DELETED")]
public bool Deleted { get; set; }
[Required]
[Column("DATE_FORMAT")]
[StringLength(10)]
[DefaultValue("dd.MM.yyyy")]
public string DateFormat { get; set; }
[Required]
[Column("ACTIVE")]
public bool Active { get; set; }
[Required]
[Column("GENERAL_VIEWER")]
[StringLength(30)]
[DefaultValue("NONE")]
public string GeneralViewer { get; set; }
[Required]
[Column("WAN_ENVIRONMENT")]
public bool WanEnvironment { get; set; }
[Required]
[Column("USERID_FK_INT_ECM")]
public int UseridFkIntEcm { get; set; }
[Column("DELETED_WHEN")]
public DateTime DeletedWhen { get; set; }
[Column("DELETED_WHO")]
[StringLength(50)]
public string DeletedWho { get; set; }
}
}

View File

@ -3,7 +3,6 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net462;net7.0;net8.0;net9.0</TargetFrameworks> <TargetFrameworks>net462;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'"> <ItemGroup Condition="'$(TargetFramework)' == 'net462'">