generated from zobweyt/Discord.Net.Template
-
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.
- Loading branch information
Showing
2 changed files
with
28 additions
and
21 deletions.
There are no files selected for viewing
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,28 @@ | ||
using System; | ||
using Discord; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace Giveaways.Data; | ||
|
||
/// <summary> | ||
/// Represents an abstract class for entities with a key identifier. | ||
/// </summary> | ||
/// <typeparam name="TId">The type of the key identifier.</typeparam> | ||
public abstract class KeyedEntity<TId> : IEntity<TId> | ||
where TId : IEquatable<TId> | ||
{ | ||
public TId Id { get; init; } = default!; | ||
} | ||
|
||
/// <summary> | ||
/// Represents an abstract class for configuring entities with a key identifier. | ||
/// </summary> | ||
/// <typeparam name="TId">The type of the key identifier.</typeparam> | ||
/// <typeparam name="TEntity">The type of the entity.</typeparam> | ||
internal abstract class KeyedEntityConfiguration<TId, TEntity> : IEntityTypeConfiguration<TEntity> | ||
where TId : IEquatable<TId> | ||
where TEntity : KeyedEntity<TId> | ||
{ | ||
public abstract void Configure(EntityTypeBuilder<TEntity> builder); | ||
} |