Add EF Core data annotations to view models
Added [Key], [Column], and [Table] attributes to ProfileView, RecActionView, and ResultView classes to explicitly map properties to database columns and views. Expanded model properties for clearer schema alignment and improved maintainability with Entity Framework Core.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using ReC.Domain.Constants;
|
using ReC.Domain.Constants;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace ReC.Domain.Views;
|
namespace ReC.Domain.Views;
|
||||||
@@ -8,39 +9,58 @@ public record ProfileView
|
|||||||
{
|
{
|
||||||
public virtual IEnumerable<RecActionView>? Actions { get; init; }
|
public virtual IEnumerable<RecActionView>? Actions { get; init; }
|
||||||
|
|
||||||
|
[Key]
|
||||||
|
[Column("PROFILE_GUID")]
|
||||||
public long Id { get; init; }
|
public long Id { get; init; }
|
||||||
|
|
||||||
|
[Column("ACTIVE")]
|
||||||
public bool Active { get; init; }
|
public bool Active { get; init; }
|
||||||
|
|
||||||
|
[Column("TYPE_ID")]
|
||||||
public ProfileType TypeId { get; init; }
|
public ProfileType TypeId { get; init; }
|
||||||
|
|
||||||
|
[Column("TYPE")]
|
||||||
public string? Type { get; init; }
|
public string? Type { get; init; }
|
||||||
|
|
||||||
|
[Column("MANDANTOR")]
|
||||||
public string? Mandantor { get; init; }
|
public string? Mandantor { get; init; }
|
||||||
|
|
||||||
|
[Column("PROFILE_NAME")]
|
||||||
public string? ProfileName { get; init; }
|
public string? ProfileName { get; init; }
|
||||||
|
|
||||||
|
[Column("DESCRIPTION")]
|
||||||
public string? Description { get; init; }
|
public string? Description { get; init; }
|
||||||
|
|
||||||
|
[Column("LOG_LEVEL_ID")]
|
||||||
public byte LogLevelId { get; init; }
|
public byte LogLevelId { get; init; }
|
||||||
|
|
||||||
|
[Column("LOG_LEVEL")]
|
||||||
public string? LogLevel { get; init; }
|
public string? LogLevel { get; init; }
|
||||||
|
|
||||||
|
[Column("LANGUAGE_ID")]
|
||||||
public short LanguageId { get; init; }
|
public short LanguageId { get; init; }
|
||||||
|
|
||||||
|
[Column("LANGUAGE")]
|
||||||
public string? Language { get; init; }
|
public string? Language { get; init; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; init; }
|
public string? AddedWho { get; init; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime AddedWhen { get; init; }
|
public DateTime AddedWhen { get; init; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; init; }
|
public string? ChangedWho { get; init; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; init; }
|
public DateTime? ChangedWhen { get; init; }
|
||||||
|
|
||||||
|
[Column("FIRST_RUN")]
|
||||||
public DateTime? FirstRun { get; init; }
|
public DateTime? FirstRun { get; init; }
|
||||||
|
|
||||||
|
[Column("LAST_RUN")]
|
||||||
public DateTime? LastRun { get; init; }
|
public DateTime? LastRun { get; init; }
|
||||||
|
|
||||||
|
[Column("LAST_RESULT")]
|
||||||
public string? LastResult { get; init; }
|
public string? LastResult { get; init; }
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using ReC.Domain.Constants;
|
using ReC.Domain.Constants;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace ReC.Domain.Views;
|
namespace ReC.Domain.Views;
|
||||||
@@ -16,72 +17,106 @@ public class RecActionView
|
|||||||
{
|
{
|
||||||
public virtual IEnumerable<ResultView>? Results { get; set; }
|
public virtual IEnumerable<ResultView>? Results { get; set; }
|
||||||
|
|
||||||
|
[Key]
|
||||||
|
[Column("ACTION_GUID")]
|
||||||
public required long Id { get; set; }
|
public required long Id { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_ID")]
|
||||||
public long? ProfileId { get; set; }
|
public long? ProfileId { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ProfileId")]
|
[ForeignKey("ProfileId")]
|
||||||
public ProfileView? Profile { get; set; }
|
public ProfileView? Profile { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_NAME")]
|
||||||
public string? ProfileName { get; set; }
|
public string? ProfileName { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_TYPE_ID")]
|
||||||
public ProfileType? ProfileType { get; set; }
|
public ProfileType? ProfileType { get; set; }
|
||||||
|
|
||||||
|
[Column("SEQUENCE")]
|
||||||
public byte? Sequence { get; set; }
|
public byte? Sequence { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_ID")]
|
||||||
public long? EndpointId { get; set; }
|
public long? EndpointId { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_URI")]
|
||||||
public string? EndpointUri { get; set; }
|
public string? EndpointUri { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_ID")]
|
||||||
public long? EndpointAuthId { get; set; }
|
public long? EndpointAuthId { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_TYPE_ID")]
|
||||||
public EndpointAuthType? EndpointAuthType { get; set; }
|
public EndpointAuthType? EndpointAuthType { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_TYPE")]
|
||||||
public string? EndpointAuthTypeName { get; set; }
|
public string? EndpointAuthTypeName { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_KEY")]
|
||||||
public string? EndpointAuthApiKey { get; set; }
|
public string? EndpointAuthApiKey { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_VALUE")]
|
||||||
public string? EndpointAuthApiValue { get; set; }
|
public string? EndpointAuthApiValue { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_KEY_ADD_TO_ID")]
|
||||||
public ApiKeyLocation? EndpointAuthApiKeyAddTo { get; set; }
|
public ApiKeyLocation? EndpointAuthApiKeyAddTo { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_KEY_ADD_TO")]
|
||||||
public string? EndpointAuthApiKeyAddToName { get; set; }
|
public string? EndpointAuthApiKeyAddToName { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_TOKEN")]
|
||||||
public string? EndpointAuthToken { get; set; }
|
public string? EndpointAuthToken { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_USERNAME")]
|
||||||
public string? EndpointAuthUsername { get; set; }
|
public string? EndpointAuthUsername { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_PASSWORD")]
|
||||||
public string? EndpointAuthPassword { get; set; }
|
public string? EndpointAuthPassword { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_DOMAIN")]
|
||||||
public string? EndpointAuthDomain { get; set; }
|
public string? EndpointAuthDomain { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_WORKSTATION")]
|
||||||
public string? EndpointAuthWorkstation { get; set; }
|
public string? EndpointAuthWorkstation { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_PARAMS_ID")]
|
||||||
public short? EndpointParamsId { get; set; }
|
public short? EndpointParamsId { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_ID")]
|
||||||
public short? SqlConnectionId { get; set; }
|
public short? SqlConnectionId { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_SERVER")]
|
||||||
public string? SqlConnectionServer { get; set; }
|
public string? SqlConnectionServer { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_DB")]
|
||||||
public string? SqlConnectionDb { get; set; }
|
public string? SqlConnectionDb { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_USERNAME")]
|
||||||
public string? SqlConnectionUsername { get; set; }
|
public string? SqlConnectionUsername { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_PASSWORD")]
|
||||||
public string? SqlConnectionPassword { get; set; }
|
public string? SqlConnectionPassword { get; set; }
|
||||||
|
|
||||||
|
[Column("REST_TYPE_ID")]
|
||||||
public RestType? RestType { get; set; }
|
public RestType? RestType { get; set; }
|
||||||
|
|
||||||
|
[Column("REST_TYPE")]
|
||||||
public string? RestTypeName { get; set; }
|
public string? RestTypeName { get; set; }
|
||||||
|
|
||||||
|
[Column("PREPROCESSING_QUERY")]
|
||||||
public string? PreprocessingQuery { get; set; }
|
public string? PreprocessingQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("HEADER_QUERY")]
|
||||||
public string? HeaderQuery { get; set; }
|
public string? HeaderQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("BODY_QUERY")]
|
||||||
public string? BodyQuery { get; set; }
|
public string? BodyQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("POSTPROCESSING_QUERY")]
|
||||||
public string? PostprocessingQuery { get; set; }
|
public string? PostprocessingQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("ERROR_ACTION_ID")]
|
||||||
public ErrorAction? ErrorAction { get; set; }
|
public ErrorAction? ErrorAction { get; set; }
|
||||||
|
|
||||||
|
[Column("ERROR_ACTION")]
|
||||||
public string? ErrorActionName { get; set; }
|
public string? ErrorActionName { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using ReC.Domain.Constants;
|
using ReC.Domain.Constants;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace ReC.Domain.Views;
|
namespace ReC.Domain.Views;
|
||||||
@@ -6,39 +7,56 @@ namespace ReC.Domain.Views;
|
|||||||
[Table("VWREC_RESULT", Schema = "dbo")]
|
[Table("VWREC_RESULT", Schema = "dbo")]
|
||||||
public class ResultView
|
public class ResultView
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("RESULT_GUID")]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTION_ID")]
|
||||||
public long? ActionId { get; set; }
|
public long? ActionId { get; set; }
|
||||||
|
|
||||||
public RecActionView? Action { get; set; }
|
public RecActionView? Action { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_ID")]
|
||||||
public long? ProfileId { get; set; }
|
public long? ProfileId { get; set; }
|
||||||
|
|
||||||
public ProfileView? Profile { get; set; }
|
public ProfileView? Profile { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_NAME")]
|
||||||
public string? ProfileName { get; set; }
|
public string? ProfileName { get; set; }
|
||||||
|
|
||||||
|
[Column("STATUS_ID")]
|
||||||
public short? StatusCode { get; set; }
|
public short? StatusCode { get; set; }
|
||||||
|
|
||||||
|
[Column("STATUS")]
|
||||||
public string? StatusName { get; set; }
|
public string? StatusName { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_TYPE_ID")]
|
||||||
public ResultType? Type { get; set; }
|
public ResultType? Type { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_TYPE")]
|
||||||
public string? TypeName { get; set; }
|
public string? TypeName { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_HEADER")]
|
||||||
public string? Header { get; set; }
|
public string? Header { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_BODY")]
|
||||||
public string? Body { get; set; }
|
public string? Body { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_INFO")]
|
||||||
public string? Info { get; set; }
|
public string? Info { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_ERROR")]
|
||||||
public string? Error { get; set; }
|
public string? Error { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user