roadie/Roadie.Api.Library/Data/EntityBase.cs

40 lines
1,014 B
C#
Raw Normal View History

2018-11-06 22:59:48 +00:00
using Mapster;
using Roadie.Library.Enums;
2018-11-02 21:04:49 +00:00
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Roadie.Library.Data
{
public abstract class EntityBase
{
[Column("createdDate")]
[Required]
public DateTime CreatedDate { get; set; }
[Column("id")]
[Key]
2018-12-23 21:36:38 +00:00
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
2018-11-02 21:04:49 +00:00
public int Id { get; set; }
public bool? IsLocked { get; set; }
[Column("lastUpdated")]
public DateTime? LastUpdated { get; set; }
2018-11-03 21:21:36 +00:00
[Column("RoadieId")]
2018-11-02 21:04:49 +00:00
[Required]
public Guid RoadieId { get; set; }
[Column("status", TypeName = "enum")]
2018-11-11 17:27:13 +00:00
public Statuses? Status { get; set; }
2018-11-03 21:21:36 +00:00
public EntityBase()
{
this.RoadieId = Guid.NewGuid();
this.Status = Statuses.Incomplete;
this.CreatedDate = DateTime.UtcNow;
2018-11-17 02:14:32 +00:00
this.IsLocked = false;
2018-11-03 21:21:36 +00:00
}
2018-11-02 21:04:49 +00:00
}
}