roadie/RoadieLibrary/Models/EntityModelBase.cs

96 lines
2.3 KiB
C#
Raw Normal View History

2018-11-02 21:04:49 +00:00
using Mapster;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
2018-11-06 02:41:51 +00:00
namespace Roadie.Library.Models
2018-11-02 21:04:49 +00:00
{
public abstract class EntityModelBase
{
[MaxLength(65535)]
[JsonIgnore]
[IgnoreDataMember]
public string AlternateNames { get; set; }
public IEnumerable<string> AlternateNamesList
{
get
{
if (string.IsNullOrEmpty(this.AlternateNames))
{
return null;
}
return this.AlternateNames.Split('|');
}
}
2018-11-06 21:55:31 +00:00
/// <summary>
/// Set when the user has created a bookmark for the object.
/// </summary>
public Guid? UserBookmarkId { get; set; }
2018-11-02 21:04:49 +00:00
public DateTime? BeginDate { get; set; }
[Required]
2018-11-06 21:55:31 +00:00
public virtual DateTime? CreatedDate { get; set; }
2018-11-02 21:04:49 +00:00
public DateTime? EndDate { get; set; }
[Key]
[Required]
[AdaptMember("RoadieId")]
2018-11-06 21:55:31 +00:00
public virtual Guid? Id { get; set; }
2018-11-02 21:04:49 +00:00
public bool? IsLocked { get; set; }
2018-11-06 02:41:51 +00:00
public DateTime? LastUpdated { get; set; }
2018-11-02 21:04:49 +00:00
[MaxLength(250)]
public string SortName { get; set; }
public int? Status { get; set; }
[MaxLength(65535)]
[JsonIgnore]
[IgnoreDataMember]
public string Tags { get; set; }
public IEnumerable<string> TagsList
{
get
{
if (string.IsNullOrEmpty(this.Tags))
{
return null;
}
return this.Tags.Split('|');
}
}
[MaxLength(65535)]
[JsonIgnore]
[IgnoreDataMember]
public string URLs { get; set; }
public IEnumerable<string> URLsList
{
get
{
if (string.IsNullOrEmpty(this.URLs))
{
return null;
}
return this.URLs.Split('|');
}
}
public EntityModelBase()
{
this.Id = Guid.NewGuid();
this.CreatedDate = DateTime.UtcNow;
this.Status = 0;
}
}
}