Forgot unversioned xd
This commit is contained in:
15
SVSim.Database/Common/BaseEntity.cs
Normal file
15
SVSim.Database/Common/BaseEntity.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SVSim.Database.Common;
|
||||
|
||||
public class BaseEntity<TKey> : ITimeTrackedEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public virtual TKey Id { get; set; }
|
||||
|
||||
public DateTime DateCreated { get; set; } = DateTime.MinValue;
|
||||
|
||||
public DateTime? DateUpdated { get; set; }
|
||||
}
|
||||
8
SVSim.Database/Common/IDataSeeder.cs
Normal file
8
SVSim.Database/Common/IDataSeeder.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SVSim.Database.Common;
|
||||
|
||||
public interface IDataSeeder
|
||||
{
|
||||
void Seed(ModelBuilder builder);
|
||||
}
|
||||
14
SVSim.Database/Common/ITimeTrackedEntity.cs
Normal file
14
SVSim.Database/Common/ITimeTrackedEntity.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace SVSim.Database.Common;
|
||||
|
||||
public interface ITimeTrackedEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="DateTime"/> this entity was first added to the database.
|
||||
/// </summary>
|
||||
DateTime DateCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DateTime"/> this entity was last updated.
|
||||
/// </summary>
|
||||
DateTime? DateUpdated { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user