Compare commits

..

No commits in common. "28e6e98e93af3da70eb7ee51898e5fcbda58ee73" and "e7e31f7f54ba79c874b4076dd1db45c3a506a335" have entirely different histories.

9 changed files with 1 additions and 96 deletions

View File

@ -1,6 +0,0 @@
namespace EntityFrameworkCore.Data;
public class Class1
{
}

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
namespace EntityFrameworkCore.Domain;
// Since C#11, you do not need to wrap in accolades anymore.
public abstract class BaseDomainModel
{
public DateTime CreatedDate { get; set;}
}

View File

@ -1,8 +0,0 @@
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.
}

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -1,7 +0,0 @@
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; }
}

View File

@ -1,34 +0,0 @@
# Entity Framework - Dead Ball Zone
This is a practice project to learn Entity Framework.
Using the 1998 game [Dead Ball Zone](https://en.wikipedia.org/wiki/Dead_Ball_Zone) for inspiration.
## .NET commands:
### NuGet commands
Install [Entity Framework Core NuGet package](https://www.nuget.org/packages/microsoft.entityframeworkcore):
`dotnet add package Microsoft.EntityFrameworkCore --version 9.0.3`
### Creation commands
To list all available templates:
`dotnet new -l`
New class:
`dotnet new class -n MyClass`
adding to an existing solution:
`dotnet sln add Data/Data.csproj`
## Terms
A **database-context** is an abstraction of the database structure in code.
* It lists the models and their database table names.
* It instantiates a database connection during the runtime of the application.
* Allows configurations to be made in code.

View File

@ -1,13 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "entity-framework", "entity-framework.csproj", "{F651371C-C6DF-B407-B9D0-5E6C224D4CD2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.Data", "EntityFrameworkCore.Data\EntityFrameworkCore.Data.csproj", "{EB2B89D9-FE82-47CC-877F-223A4CA1755E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.Domain", "EntityFrameworkCore.Domain\EntityFrameworkCore.Domain.csproj", "{DC955178-72C3-4574-86DE-1D966E38780E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -18,14 +14,6 @@ Global
{F651371C-C6DF-B407-B9D0-5E6C224D4CD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F651371C-C6DF-B407-B9D0-5E6C224D4CD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F651371C-C6DF-B407-B9D0-5E6C224D4CD2}.Release|Any CPU.Build.0 = Release|Any CPU
{EB2B89D9-FE82-47CC-877F-223A4CA1755E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB2B89D9-FE82-47CC-877F-223A4CA1755E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB2B89D9-FE82-47CC-877F-223A4CA1755E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB2B89D9-FE82-47CC-877F-223A4CA1755E}.Release|Any CPU.Build.0 = Release|Any CPU
{DC955178-72C3-4574-86DE-1D966E38780E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC955178-72C3-4574-86DE-1D966E38780E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC955178-72C3-4574-86DE-1D966E38780E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC955178-72C3-4574-86DE-1D966E38780E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -7,8 +7,4 @@
<RootNamespace>entity_framework</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
</ItemGroup>
</Project>