Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CSharp 2020 Fall
Course Materials
Commits
bd462c68
Commit
bd462c68
authored
Dec 11, 2020
by
Andres Käver
Browse files
exam
parent
bf2791a0
Changes
418
Expand all
Hide whitespace changes
Inline
Side-by-side
demos/ExamPractice2020/.idea/.idea.ExamPractice2020/.idea/.gitignore
0 → 100644
View file @
bd462c68
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/modules.xml
/projectSettingsUpdater.xml
/.idea.ExamPractice2020.iml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
demos/ExamPractice2020/.idea/.idea.ExamPractice2020/.idea/encodings.xml
0 → 100644
View file @
bd462c68
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Encoding"
addBOMForNewFiles=
"with BOM under Windows, with no BOM otherwise"
/>
</project>
\ No newline at end of file
demos/ExamPractice2020/.idea/.idea.ExamPractice2020/.idea/indexLayout.xml
0 → 100644
View file @
bd462c68
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ContentModelUserStore"
>
<attachedFolders
/>
<explicitIncludes
/>
<explicitExcludes
/>
</component>
</project>
\ No newline at end of file
demos/ExamPractice2020/.idea/.idea.ExamPractice2020/.idea/misc.xml
0 → 100644
View file @
bd462c68
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"com.jetbrains.rider.android.RiderAndroidMiscFileCreationComponent"
>
<option
name=
"ENSURE_MISC_FILE_EXISTS"
value=
"true"
/>
</component>
</project>
\ No newline at end of file
demos/ExamPractice2020/.idea/.idea.ExamPractice2020/.idea/riderModule.iml
0 → 100644
View file @
bd462c68
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"RIDER_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$/../.."
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
demos/ExamPractice2020/.idea/.idea.ExamPractice2020/.idea/vcs.xml
0 → 100644
View file @
bd462c68
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/../.."
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
demos/ExamPractice2020/DAL.App.EF/ApplicationDbContext.cs
0 → 100644
View file @
bd462c68
using
Domain
;
using
Microsoft.AspNetCore.Identity.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
namespace
DAL.App.EF
{
public
class
ApplicationDbContext
:
IdentityDbContext
{
public
DbSet
<
Category
>
Categories
{
get
;
set
;
}
=
default
!;
public
DbSet
<
Ingredient
>
Ingredients
{
get
;
set
;
}
=
default
!;
public
DbSet
<
Product
>
Products
{
get
;
set
;
}
=
default
!;
public
DbSet
<
Recipe
>
Recipes
{
get
;
set
;
}
=
default
!;
public
DbSet
<
RecipeTag
>
RecipeTags
{
get
;
set
;
}
=
default
!;
public
DbSet
<
Tag
>
Tags
{
get
;
set
;
}
=
default
!;
public
DbSet
<
Unit
>
Units
{
get
;
set
;
}
=
default
!;
public
ApplicationDbContext
(
DbContextOptions
<
ApplicationDbContext
>
options
)
:
base
(
options
)
{
}
}
}
\ No newline at end of file
demos/ExamPractice2020/DAL.App.EF/DAL.App.EF.csproj
0 → 100644
View file @
bd462c68
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
</ItemGroup>
</Project>
demos/ExamPractice2020/DAL.App.EF/Migrations/20201211121249_InitialMigration.Designer.cs
0 → 100644
View file @
bd462c68
// <auto-generated />
using
System
;
using
DAL.App.EF
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Metadata
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
namespace
DAL.App.EF.Migrations
{
[
DbContext
(
typeof
(
ApplicationDbContext
))]
[
Migration
(
"20201211121249_InitialMigration"
)]
partial
class
InitialMigration
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
UseIdentityColumns
()
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.1"
);
modelBuilder
.
Entity
(
"Domain.Category"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
64
)
.
HasColumnType
(
"nvarchar(64)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Categories"
);
});
modelBuilder
.
Entity
(
"Domain.Ingredient"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"Comment"
)
.
HasMaxLength
(
128
)
.
HasColumnType
(
"nvarchar(128)"
);
b
.
Property
<
int
>(
"ProductId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
double
?>(
"Quantity"
)
.
HasColumnType
(
"float"
);
b
.
Property
<
int
>(
"RecipeId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProductId"
);
b
.
HasIndex
(
"RecipeId"
);
b
.
ToTable
(
"Ingredients"
);
});
modelBuilder
.
Entity
(
"Domain.Product"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
64
)
.
HasColumnType
(
"nvarchar(64)"
);
b
.
Property
<
int
>(
"UnitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UnitId"
);
b
.
ToTable
(
"Products"
);
});
modelBuilder
.
Entity
(
"Domain.Recipe"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
int
>(
"CategoryId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Description"
)
.
IsRequired
()
.
HasMaxLength
(
4096
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Instructions"
)
.
IsRequired
()
.
HasMaxLength
(
4096
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
64
)
.
HasColumnType
(
"nvarchar(64)"
);
b
.
Property
<
TimeSpan
>(
"PrepTime"
)
.
HasColumnType
(
"time"
);
b
.
Property
<
int
>(
"Servings"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CategoryId"
);
b
.
ToTable
(
"Recipes"
);
});
modelBuilder
.
Entity
(
"Domain.RecipeTag"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
int
>(
"RecipeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TagId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"RecipeId"
);
b
.
HasIndex
(
"TagId"
);
b
.
ToTable
(
"RecipeTags"
);
});
modelBuilder
.
Entity
(
"Domain.Tag"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
64
)
.
HasColumnType
(
"nvarchar(64)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Tags"
);
});
modelBuilder
.
Entity
(
"Domain.Unit"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
64
)
.
HasColumnType
(
"nvarchar(64)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Units"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRole"
,
b
=>
{
b
.
Property
<
string
>(
"Id"
)
.
HasColumnType
(
"nvarchar(450)"
);
b
.
Property
<
string
>(
"ConcurrencyStamp"
)
.
IsConcurrencyToken
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"nvarchar(256)"
);
b
.
Property
<
string
>(
"NormalizedName"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"nvarchar(256)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"NormalizedName"
)
.
IsUnique
()
.
HasDatabaseName
(
"RoleNameIndex"
)
.
HasFilter
(
"[NormalizedName] IS NOT NULL"
);
b
.
ToTable
(
"AspNetRoles"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"ClaimType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ClaimValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"RoleId"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(450)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetRoleClaims"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUser"
,
b
=>
{
b
.
Property
<
string
>(
"Id"
)
.
HasColumnType
(
"nvarchar(450)"
);
b
.
Property
<
int
>(
"AccessFailedCount"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"ConcurrencyStamp"
)
.
IsConcurrencyToken
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"nvarchar(256)"
);
b
.
Property
<
bool
>(
"EmailConfirmed"
)
.
HasColumnType
(
"bit"
);
b
.
Property
<
bool
>(
"LockoutEnabled"
)
.
HasColumnType
(
"bit"
);
b
.
Property
<
DateTimeOffset
?>(
"LockoutEnd"
)
.
HasColumnType
(
"datetimeoffset"
);
b
.
Property
<
string
>(
"NormalizedEmail"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"nvarchar(256)"
);
b
.
Property
<
string
>(
"NormalizedUserName"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"nvarchar(256)"
);
b
.
Property
<
string
>(
"PasswordHash"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"PhoneNumber"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
bool
>(
"PhoneNumberConfirmed"
)
.
HasColumnType
(
"bit"
);
b
.
Property
<
string
>(
"SecurityStamp"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
bool
>(
"TwoFactorEnabled"
)
.
HasColumnType
(
"bit"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasMaxLength
(
256
)
.
HasColumnType
(
"nvarchar(256)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"NormalizedEmail"
)
.
HasDatabaseName
(
"EmailIndex"
);
b
.
HasIndex
(
"NormalizedUserName"
)
.
IsUnique
()
.
HasDatabaseName
(
"UserNameIndex"
)
.
HasFilter
(
"[NormalizedUserName] IS NOT NULL"
);
b
.
ToTable
(
"AspNetUsers"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<string>"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
UseIdentityColumn
();
b
.
Property
<
string
>(
"ClaimType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ClaimValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserId"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(450)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserClaims"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<string>"
,
b
=>
{
b
.
Property
<
string
>(
"LoginProvider"
)
.
HasMaxLength
(
128
)
.
HasColumnType
(
"nvarchar(128)"
);
b
.
Property
<
string
>(
"ProviderKey"
)
.
HasMaxLength
(
128
)
.
HasColumnType
(
"nvarchar(128)"
);
b
.
Property
<
string
>(
"ProviderDisplayName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserId"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(450)"
);
b
.
HasKey
(
"LoginProvider"
,
"ProviderKey"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserLogins"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserRole<string>"
,
b
=>
{
b
.
Property
<
string
>(
"UserId"
)
.
HasColumnType
(
"nvarchar(450)"
);
b
.
Property
<
string
>(
"RoleId"
)
.
HasColumnType
(
"nvarchar(450)"
);
b
.
HasKey
(
"UserId"
,
"RoleId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetUserRoles"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserToken<string>"
,
b
=>
{
b
.
Property
<
string
>(
"UserId"
)
.
HasColumnType
(
"nvarchar(450)"
);
b
.
Property
<
string
>(
"LoginProvider"
)
.
HasMaxLength
(
128
)
.
HasColumnType
(
"nvarchar(128)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
128
)
.
HasColumnType
(
"nvarchar(128)"
);
b
.
Property
<
string
>(
"Value"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"UserId"
,
"LoginProvider"
,
"Name"
);
b
.
ToTable
(
"AspNetUserTokens"
);
});
modelBuilder
.
Entity
(
"Domain.Ingredient"
,
b
=>
{
b
.
HasOne
(
"Domain.Product"
,
"Product"
)
.
WithMany
()
.
HasForeignKey
(
"ProductId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Recipe"
,
"Recipe"
)
.
WithMany
()
.
HasForeignKey
(
"RecipeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Product"
);
b
.
Navigation
(
"Recipe"
);
});
modelBuilder
.
Entity
(
"Domain.Product"
,
b
=>
{
b
.
HasOne
(
"Domain.Unit"
,
"Unit"
)
.
WithMany
(
"Products"
)
.
HasForeignKey
(
"UnitId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Unit"
);
});
modelBuilder
.
Entity
(
"Domain.Recipe"
,
b
=>
{
b
.
HasOne
(
"Domain.Category"
,
"Category"
)
.
WithMany
(
"Recipes"
)
.
HasForeignKey
(
"CategoryId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Category"
);
});
modelBuilder
.
Entity
(
"Domain.RecipeTag"
,
b
=>
{
b
.
HasOne
(
"Domain.Recipe"
,
"Recipe"
)
.
WithMany
(
"RecipeTags"
)
.
HasForeignKey
(
"RecipeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Tag"
,
"Tag"
)
.
WithMany
(
"RecipeTags"
)
.
HasForeignKey
(
"TagId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Recipe"
);
b
.
Navigation
(
"Tag"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>"
,
b
=>
{
b
.
HasOne
(
"Microsoft.AspNetCore.Identity.IdentityRole"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<string>"
,
b
=>
{
b
.
HasOne
(
"Microsoft.AspNetCore.Identity.IdentityUser"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<string>"
,
b
=>
{
b
.
HasOne
(
"Microsoft.AspNetCore.Identity.IdentityUser"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});