-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding basic support for entity interfaces and abstracts
- Loading branch information
Showing
9 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace YuckQi.Domain.Entities.Abstract | ||
{ | ||
public abstract class EntityBase<TKey> : IEntity<TKey> where TKey : struct | ||
{ | ||
public TKey Key { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace YuckQi.Domain.Entities.Abstract | ||
{ | ||
public interface IAuditedEntity<TKey, TIdentity> : ITemporalEntity<TKey> where TKey : struct | ||
{ | ||
TIdentity CreatedBy { get; set; } | ||
TIdentity RevisedBy { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace YuckQi.Domain.Entities.Abstract | ||
{ | ||
public interface IEntity<TKey> where TKey : struct | ||
{ | ||
TKey Key { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace YuckQi.Domain.Entities.Abstract | ||
{ | ||
public interface ITemporalEntity<TKey> : IEntity<TKey> where TKey : struct | ||
{ | ||
DateTime CreationMomentUtc { get; set; } | ||
DateTime RevisionMomentUtc { get; set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/YuckQi.Domain/Entities/MultiTenant/Abstract/IMultiTenantEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using YuckQi.Domain.Entities.Abstract; | ||
|
||
namespace YuckQi.Domain.Entities.MultiTenant.Abstract | ||
{ | ||
public interface IMultiTenantEntity<TKey, TTenantKey> : IEntity<TKey> where TKey : struct where TTenantKey : struct | ||
{ | ||
TTenantKey TenantId { get; set; } | ||
|
||
bool IsValidTenant(TTenantKey? tenantId); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/YuckQi.Domain/Entities/MultiTenant/Abstract/MultiTenantEntityBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using YuckQi.Domain.Entities.Abstract; | ||
|
||
namespace YuckQi.Domain.Entities.MultiTenant.Abstract | ||
{ | ||
public abstract class MultiTenantEntityBase<TKey, TTenantKey> : EntityBase<TKey>, IMultiTenantEntity<TKey, TTenantKey> where TKey : struct where TTenantKey : struct | ||
{ | ||
public TTenantKey TenantId { get; set; } | ||
|
||
public bool IsValidTenant(TTenantKey? tenantId) | ||
{ | ||
return TenantId.Equals(tenantId); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using YuckQi.Domain.Entities.Abstract; | ||
|
||
namespace YuckQi.Domain.Entities.Types | ||
{ | ||
public abstract class TypeEntityBase<TKey> : EntityBase<TKey> where TKey : struct | ||
{ | ||
public string Code { get; set; } | ||
public string Name { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters