-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AUTO MAPPING OBJECT - FAST FOOD - WEB PROJECT
- Loading branch information
1 parent
a8ac6a3
commit 9b675e9
Showing
100 changed files
with
25,806 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+422 KB
... Mapping Objects - WebProject/08. DB-Advanced-EF-Core-Auto-Mapping-Objects-Exercises.docx
Binary file not shown.
Binary file added
BIN
+2.87 MB
10.Auto Mapping Objects - WebProject/08. DB-Advanced-EF-Core-Auto-Mapping-Objects.pptx
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
10.Auto Mapping Objects - WebProject/FastFood/FastFood.Data/FastFood.Data.csproj
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.1" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\FastFood.Models\FastFood.Models.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
42 changes: 42 additions & 0 deletions
42
10.Auto Mapping Objects - WebProject/FastFood/FastFood.Data/FastFoodContext.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,42 @@ | ||
namespace FastFood.Data | ||
{ | ||
using Microsoft.EntityFrameworkCore; | ||
using Models; | ||
|
||
public class FastFoodContext : DbContext | ||
{ | ||
public FastFoodContext() | ||
{ | ||
|
||
} | ||
|
||
public FastFoodContext(DbContextOptions<FastFoodContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
public DbSet<Category> Categories { get; set; } | ||
|
||
public DbSet<Employee> Employees { get; set; } | ||
|
||
public DbSet<Item> Items { get; set; } | ||
|
||
public DbSet<Order> Orders { get; set; } | ||
|
||
public DbSet<OrderItem> OrderItems { get; set; } | ||
|
||
public DbSet<Position> Positions { get; set; } | ||
|
||
protected override void OnModelCreating(ModelBuilder builder) | ||
{ | ||
builder.Entity<OrderItem>() | ||
.HasKey(oi => new { oi.OrderId, oi.ItemId }); | ||
|
||
builder.Entity<Position>() | ||
.HasAlternateKey(p => p.Name); | ||
|
||
builder.Entity<Item>() | ||
.HasAlternateKey(i => i.Name); | ||
} | ||
} | ||
} |
180 changes: 180 additions & 0 deletions
180
...Objects - WebProject/FastFood/FastFood.Data/Migrations/20190115112329_Initial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.