Add models for BaseDomainModel, Coach and Team.
This commit is contained in:
parent
62ae17f271
commit
5e688a24d5
6
EntityFrameworkCore.Domain/BaseDomainModel.cs
Normal file
6
EntityFrameworkCore.Domain/BaseDomainModel.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace EntityFrameworkCore.Domain;
|
||||
// Since C#11, you do not need to wrap in accolades anymore.
|
||||
public abstract class BaseDomainModel
|
||||
{
|
||||
public DateTime CreatedDate { get; set;}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
namespace EntityFrameworkCore.Domain;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
8
EntityFrameworkCore.Domain/Coach.cs
Normal file
8
EntityFrameworkCore.Domain/Coach.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace EntityFrameworkCore.Domain;
|
||||
// Since C#11, you do not need to wrap in accolades anymore.
|
||||
public class Coach : BaseDomainModel
|
||||
{
|
||||
public int Id { get; set; } // Anything called "Id" is automatically a Primary Key.
|
||||
public string Name { get; set; } // Strings are automatically become VARCHAR database types.
|
||||
}
|
||||
|
||||
7
EntityFrameworkCore.Domain/Team.cs
Normal file
7
EntityFrameworkCore.Domain/Team.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace EntityFrameworkCore.Domain;
|
||||
// Since C#11, you do not need to wrap in accolades anymore.
|
||||
public class Team : BaseDomainModel
|
||||
{
|
||||
public int TeamId { get; set;} // This naming convention also allows EF to see this as a PK.
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user