Преглед на файлове

Projektdateien hinzufügen.

master
siegfried.dorn@gmx.de преди 3 години
родител
ревизия
7b30560d87
променени са 16 файла, в които са добавени 1055 реда и са изтрити 0 реда
  1. +25
    -0
      EF_Code_First.sln
  2. +34
    -0
      EF_Code_First/EF_Code_First.csproj
  3. +86
    -0
      EF_Code_First/Migrations/20220312173822_V0.0.Designer.cs
  4. +64
    -0
      EF_Code_First/Migrations/20220312173822_V0.0.cs
  5. +88
    -0
      EF_Code_First/Migrations/20220313151637_V0.2.Designer.cs
  6. +64
    -0
      EF_Code_First/Migrations/20220313151637_V0.2.cs
  7. +93
    -0
      EF_Code_First/Migrations/20220313154925_V0.3.Designer.cs
  8. +89
    -0
      EF_Code_First/Migrations/20220313154925_V0.3.cs
  9. +91
    -0
      EF_Code_First/Migrations/SC_DbContextModelSnapshot.cs
  10. +13
    -0
      EF_Code_First/Models/Grade.cs
  11. +34
    -0
      EF_Code_First/Models/SC_DbContext.cs
  12. +36
    -0
      EF_Code_First/Models/Student.cs
  13. +68
    -0
      EF_Code_First/Program.cs
  14. +63
    -0
      EF_Code_First/Properties/Resources.Designer.cs
  15. +101
    -0
      EF_Code_First/Properties/Resources.resx
  16. +106
    -0
      EF_Code_First/SC_DbContext.dgml

+ 25
- 0
EF_Code_First.sln Целия файл

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32210.238
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EF_Code_First", "EF_Code_First\EF_Code_First.csproj", "{FFBBD235-ECBD-4D08-BA8D-DA902622CA7F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FFBBD235-ECBD-4D08-BA8D-DA902622CA7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFBBD235-ECBD-4D08-BA8D-DA902622CA7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFBBD235-ECBD-4D08-BA8D-DA902622CA7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFBBD235-ECBD-4D08-BA8D-DA902622CA7F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BFDEE537-EF31-4DDF-93C3-98B5DD3FFCFF}
EndGlobalSection
EndGlobal

+ 34
- 0
EF_Code_First/EF_Code_First.csproj Целия файл

@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.3" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>

+ 86
- 0
EF_Code_First/Migrations/20220312173822_V0.0.Designer.cs Целия файл

@@ -0,0 +1,86 @@
// <auto-generated />
using System;
using EF_Code_First.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace EF_Code_First.Migrations
{
[DbContext(typeof(SC_DbContext))]
[Migration("20220312173822_V0.0")]
partial class V00
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.3");

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Property<int>("GradeId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<string>("GradeName")
.HasColumnType("TEXT");

b.Property<string>("Section")
.HasColumnType("TEXT");

b.HasKey("GradeId");

b.ToTable("Grade", (string)null);
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.Property<int>("StudentId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<DateTime?>("DateOfBirth")
.HasColumnType("TEXT");

b.Property<int>("GradeId")
.HasColumnType("INTEGER");

b.Property<decimal?>("Height")
.HasColumnType("TEXT");

b.Property<byte[]>("Photo")
.HasColumnType("BLOB");

b.Property<string>("StudentName")
.HasColumnType("TEXT");

b.Property<float?>("Weight")
.HasColumnType("REAL");

b.HasKey("StudentId");

b.HasIndex("GradeId");

b.ToTable("Students", (string)null);
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.HasOne("EF_Code_First.Models.Grade", "Grade")
.WithMany("Students")
.HasForeignKey("GradeId");

b.Navigation("Grade");
});

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Navigation("Students");
});
#pragma warning restore 612, 618
}
}
}

+ 64
- 0
EF_Code_First/Migrations/20220312173822_V0.0.cs Целия файл

@@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace EF_Code_First.Migrations
{
public partial class V00 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Grade",
columns: table => new
{
GradeId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
GradeName = table.Column<string>(type: "TEXT", nullable: true),
Section = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Grade", x => x.GradeId);
});

migrationBuilder.CreateTable(
name: "Students",
columns: table => new
{
StudentId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
StudentName = table.Column<string>(type: "TEXT", nullable: true),
DateOfBirth = table.Column<DateTime>(type: "TEXT", nullable: true),
Photo = table.Column<byte[]>(type: "BLOB", nullable: true),
Height = table.Column<decimal>(type: "TEXT", nullable: true),
Weight = table.Column<float>(type: "REAL", nullable: true),
GradeId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Students", x => x.StudentId);
table.ForeignKey(
name: "FK_Students_Grade_GradeId",
column: x => x.GradeId,
principalTable: "Grade",
principalColumn: "GradeId");
});

migrationBuilder.CreateIndex(
name: "IX_Students_GradeId",
table: "Students",
column: "GradeId");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Students");

migrationBuilder.DropTable(
name: "Grade");
}
}
}

+ 88
- 0
EF_Code_First/Migrations/20220313151637_V0.2.Designer.cs Целия файл

@@ -0,0 +1,88 @@
// <auto-generated />
using System;
using EF_Code_First.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace EF_Code_First.Migrations
{
[DbContext(typeof(SC_DbContext))]
[Migration("20220313151637_V0.2")]
partial class V02
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.3");

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Property<int>("GradeId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<string>("GradeName")
.HasColumnType("TEXT");

b.Property<string>("Section")
.HasColumnType("TEXT");

b.HasKey("GradeId");

b.ToTable("Grades");
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.Property<int>("StudentId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<DateTime?>("DateOfBirth")
.HasColumnType("TEXT");

b.Property<int>("GradeId")
.HasColumnType("INTEGER");

b.Property<decimal?>("Height")
.HasColumnType("TEXT");

b.Property<byte[]>("Photo")
.HasColumnType("BLOB");

b.Property<string>("StudentName")
.HasColumnType("TEXT");

b.Property<float?>("Weight")
.HasColumnType("REAL");

b.HasKey("StudentId");

b.HasIndex("GradeId");

b.ToTable("Students");
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.HasOne("EF_Code_First.Models.Grade", "Grade")
.WithMany("Students")
.HasForeignKey("GradeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Grade");
});

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Navigation("Students");
});
#pragma warning restore 612, 618
}
}
}

+ 64
- 0
EF_Code_First/Migrations/20220313151637_V0.2.cs Целия файл

@@ -0,0 +1,64 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace EF_Code_First.Migrations
{
public partial class V02 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_Grade_GradeId",
table: "Students");

migrationBuilder.DropPrimaryKey(
name: "PK_Grade",
table: "Grade");

migrationBuilder.RenameTable(
name: "Grade",
newName: "Grades");

migrationBuilder.AddPrimaryKey(
name: "PK_Grades",
table: "Grades",
column: "GradeId");

migrationBuilder.AddForeignKey(
name: "FK_Students_Grades_GradeId",
table: "Students",
column: "GradeId",
principalTable: "Grades",
principalColumn: "GradeId",
onDelete: ReferentialAction.Cascade);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_Grades_GradeId",
table: "Students");

migrationBuilder.DropPrimaryKey(
name: "PK_Grades",
table: "Grades");

migrationBuilder.RenameTable(
name: "Grades",
newName: "Grade");

migrationBuilder.AddPrimaryKey(
name: "PK_Grade",
table: "Grade",
column: "GradeId");

migrationBuilder.AddForeignKey(
name: "FK_Students_Grade_GradeId",
table: "Students",
column: "GradeId",
principalTable: "Grade",
principalColumn: "GradeId");
}
}
}

+ 93
- 0
EF_Code_First/Migrations/20220313154925_V0.3.Designer.cs Целия файл

@@ -0,0 +1,93 @@
// <auto-generated />
using System;
using EF_Code_First.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace EF_Code_First.Migrations
{
[DbContext(typeof(SC_DbContext))]
[Migration("20220313154925_V0.3")]
partial class V03
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.3");

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Property<int>("GradeId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<string>("GradeName")
.HasColumnType("TEXT");

b.Property<string>("Section")
.HasColumnType("TEXT");

b.HasKey("GradeId");

b.ToTable("Grades");
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.Property<int>("StudentId")
.HasColumnType("INTEGER");

b.Property<DateTime?>("DateOfBirth")
.HasColumnType("TEXT");

b.Property<int>("G_Id")
.HasColumnType("INTEGER");

b.Property<decimal?>("Height")
.HasColumnType("TEXT");

b.Property<byte[]>("Photo")
.HasColumnType("BLOB");

b.Property<string>("StudentName")
.HasColumnType("TEXT");

b.Property<float?>("Weight")
.HasColumnType("REAL");

b.HasKey("StudentId");

b.HasIndex("G_Id");

b.ToTable("Students");
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.HasOne("EF_Code_First.Models.Grade", "Grade")
.WithMany()
.HasForeignKey("G_Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("EF_Code_First.Models.Grade", null)
.WithMany("Students")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Grade");
});

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Navigation("Students");
});
#pragma warning restore 612, 618
}
}
}

+ 89
- 0
EF_Code_First/Migrations/20220313154925_V0.3.cs Целия файл

@@ -0,0 +1,89 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace EF_Code_First.Migrations
{
public partial class V03 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_Grades_GradeId",
table: "Students");

migrationBuilder.RenameColumn(
name: "GradeId",
table: "Students",
newName: "G_Id");

migrationBuilder.RenameIndex(
name: "IX_Students_GradeId",
table: "Students",
newName: "IX_Students_G_Id");

migrationBuilder.AlterColumn<int>(
name: "StudentId",
table: "Students",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER")
.OldAnnotation("Sqlite:Autoincrement", true);

migrationBuilder.AddForeignKey(
name: "FK_Students_Grades_G_Id",
table: "Students",
column: "G_Id",
principalTable: "Grades",
principalColumn: "GradeId",
onDelete: ReferentialAction.Cascade);

migrationBuilder.AddForeignKey(
name: "FK_Students_Grades_StudentId",
table: "Students",
column: "StudentId",
principalTable: "Grades",
principalColumn: "GradeId",
onDelete: ReferentialAction.Cascade);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_Grades_G_Id",
table: "Students");

migrationBuilder.DropForeignKey(
name: "FK_Students_Grades_StudentId",
table: "Students");

migrationBuilder.RenameColumn(
name: "G_Id",
table: "Students",
newName: "GradeId");

migrationBuilder.RenameIndex(
name: "IX_Students_G_Id",
table: "Students",
newName: "IX_Students_GradeId");

migrationBuilder.AlterColumn<int>(
name: "StudentId",
table: "Students",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER")
.Annotation("Sqlite:Autoincrement", true);

migrationBuilder.AddForeignKey(
name: "FK_Students_Grades_GradeId",
table: "Students",
column: "GradeId",
principalTable: "Grades",
principalColumn: "GradeId",
onDelete: ReferentialAction.Cascade);
}
}
}

+ 91
- 0
EF_Code_First/Migrations/SC_DbContextModelSnapshot.cs Целия файл

@@ -0,0 +1,91 @@
// <auto-generated />
using System;
using EF_Code_First.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace EF_Code_First.Migrations
{
[DbContext(typeof(SC_DbContext))]
partial class SC_DbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.3");

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Property<int>("GradeId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<string>("GradeName")
.HasColumnType("TEXT");

b.Property<string>("Section")
.HasColumnType("TEXT");

b.HasKey("GradeId");

b.ToTable("Grades");
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.Property<int>("StudentId")
.HasColumnType("INTEGER");

b.Property<DateTime?>("DateOfBirth")
.HasColumnType("TEXT");

b.Property<int>("G_Id")
.HasColumnType("INTEGER");

b.Property<decimal?>("Height")
.HasColumnType("TEXT");

b.Property<byte[]>("Photo")
.HasColumnType("BLOB");

b.Property<string>("StudentName")
.HasColumnType("TEXT");

b.Property<float?>("Weight")
.HasColumnType("REAL");

b.HasKey("StudentId");

b.HasIndex("G_Id");

b.ToTable("Students");
});

modelBuilder.Entity("EF_Code_First.Models.Student", b =>
{
b.HasOne("EF_Code_First.Models.Grade", "Grade")
.WithMany()
.HasForeignKey("G_Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("EF_Code_First.Models.Grade", null)
.WithMany("Students")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Grade");
});

modelBuilder.Entity("EF_Code_First.Models.Grade", b =>
{
b.Navigation("Students");
});
#pragma warning restore 612, 618
}
}
}

+ 13
- 0
EF_Code_First/Models/Grade.cs Целия файл

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations.Schema;

namespace EF_Code_First.Models
{
public class Grade
{
public int GradeId { get; set; }
public string? GradeName { get; set; }
public string? Section { get; set; }
[ForeignKey ("StudentId")]
public ICollection<Student>? Students { get; set; }
}
}

+ 34
- 0
EF_Code_First/Models/SC_DbContext.cs Целия файл

@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore;

namespace EF_Code_First.Models
{
public class SC_DbContext : DbContext
{
public string DbPath { get; }
public DbSet<Student> Students { get; set; }
public DbSet<Grade> Grades { get; set; }

public SC_DbContext() : base()
{
var folder = Environment.SpecialFolder.LocalApplicationData;
var path = Environment.GetFolderPath(folder);
DbPath = Path.Join(path, "student.db");
}

protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
/*
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Student>().HasOne(g => g.Grade)
.WithMany(s => s.Students)
.IsRequired(true);
modelBuilder.Entity<Student>().ToTable("Students");
modelBuilder.Entity<Grade>().HasMany(s => s.Students)
.WithOne(s => s.Grade)
.IsRequired(false);
modelBuilder.Entity<Grade>().ToTable("Grade");
}
*/
}
}

+ 36
- 0
EF_Code_First/Models/Student.cs Целия файл

@@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace EF_Code_First.Models
{
public class Student
{
public int StudentId { get; set; }
public string? StudentName { get; set; }
public DateTime? DateOfBirth { get; set; }
public byte[]? Photo { get; set; }
public decimal? Height { get; set; }
public float? Weight { get; set; }
[ForeignKey ("Grade")]
public int G_Id { get; set; }
//Navigation Property
public Grade Grade { get; set; }


public override string ToString()
{
StringBuilder builder = new StringBuilder();
builder.Append(StudentId);
builder.Append(" :");
builder.Append(StudentName);
builder.Append(" :");
builder.Append(DateOfBirth);
builder.Append(" :");
builder.Append(Weight);
builder.Append(" :");
builder.Append(Height);
return builder.ToString();
}
}
}

+ 68
- 0
EF_Code_First/Program.cs Целия файл

@@ -0,0 +1,68 @@
using System.Text;
using EF_Code_First.Models;
using System.Linq;
using Microsoft.EntityFrameworkCore;

namespace EF_Code_First
{
public class Program
{
static void Main(string[] args)
{
using (var ctx = new SC_DbContext())
{
/*
var grade = ctx.Grades.Single(g => g.GradeId == 5);

var stud = new Student()
{
StudentName = "Michael Maier",
Weight = (float?)102,
Height = (decimal?)175,
DateOfBirth = DateTime.Parse("1970-10-11"),
Grade = grade
};
Console.WriteLine($"new Student: {stud}");
ctx.Students.Add(stud);
ctx.SaveChanges();
*/
List<Grade> grades = ctx.Grades
.Include(st=> st.Students)
.ToList();

List<Student> students = ctx.Students
.Include(g=> g.Grade)
.ToList();
foreach (var s in students)
{
//Console.WriteLine(s.Grade.ToString);
//var currentgrade = ctx.Grades.Single(g => g.GradeId == s.G_Id);
//Console.WriteLine($"Grade = {currentgrade.ToString} ");
StringBuilder b = new StringBuilder();
b.Append(s.StudentName);
b.Append(": ");
b.Append(s.Weight);
b.Append(": ");
b.Append(s.Height);
b.Append(": ");
b.Append(s.DateOfBirth);
b.Append(": ");
b.Append(s.Grade.GradeName);
b.Append(": ");
b.Append(s.Grade.Section);
Console.WriteLine(b.ToString());
}
Console.WriteLine (ctx.DbPath);
}
}
}
}

+ 63
- 0
EF_Code_First/Properties/Resources.Designer.cs Целия файл

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------

namespace EF_Code_First.Properties {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EF_Code_First.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

+ 101
- 0
EF_Code_First/Properties/Resources.resx Целия файл

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 1.3

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 106
- 0
EF_Code_First/SC_DbContext.dgml Целия файл

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph GraphDirection="LeftToRight" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="IModel" Label="SC_DbContext" ChangeTrackingStrategy="ChangeTrackingStrategy.Snapshot" PropertyAccessMode="PropertyAccessMode.Default" ProductVersion="6.0.3" Annotations="BaseTypeDiscoveryConvention:DerivedTypes: System.Collections.Generic.Dictionary`2[System.Type,System.Collections.Generic.List`1[Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType]]
RelationshipDiscoveryConvention:InverseNavigationCandidates: System.Collections.Generic.Dictionary`2[System.Type,System.Collections.Generic.SortedSet`1[System.Type]]" Category="Model" Group="Expanded" />
<Node Id = "Grade" Label="Grade" Name="Grade" BaseClass="" IsAbstract="False" ChangeTrackingStrategy="ChangeTrackingStrategy.Snapshot" Annotations="Relational:TableName: Grades
RelationshipDiscoveryConvention:NavigationCandidates: System.Collections.Immutable.ImmutableSortedDictionary`2[System.Reflection.PropertyInfo,System.ValueTuple`2[System.Type,System.Nullable`1[System.Boolean]]]" Category="EntityType" Group="Expanded" />
<Node Id = "Student" Label="Student" Name="Student" BaseClass="" IsAbstract="False" ChangeTrackingStrategy="ChangeTrackingStrategy.Snapshot" Annotations="Relational:TableName: Students
RelationshipDiscoveryConvention:NavigationCandidates: System.Collections.Immutable.ImmutableSortedDictionary`2[System.Reflection.PropertyInfo,System.ValueTuple`2[System.Type,System.Nullable`1[System.Boolean]]]" Category="EntityType" Group="Expanded" />
<Node Id = "Grade.GradeId" Label="GradeId" Name="GradeId" Category="Property Primary" Type="int" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="True" IsForeignKey="False" IsRequired="True" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="ValueGenerated.OnAdd" />
<Node Id = "Grade.Students" Label="Students (*)" Name="Students" Category="Navigation Collection" Type="ICollection&lt;Student&gt;" Field="" Dependent="Student" Principal="" Inverse="" PropertyAccessMode="PropertyAccessMode.Default" />
<Node Id = "Grade.GradeName" Label="GradeName" Name="GradeName" Category="Property Optional" Type="string" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Grade.Section" Label="Section" Name="Section" Category="Property Optional" Type="string" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student" Label="Student" Name="Student" BaseClass="" IsAbstract="False" ChangeTrackingStrategy="ChangeTrackingStrategy.Snapshot" Annotations="" Category="EntityType" Group="Expanded" />
<Node Id = "Student.StudentId" Label="StudentId" Name="StudentId" Category="Property Primary" Type="int" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="True" IsForeignKey="True" IsRequired="True" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student.Grade" Label="Grade (1)" Name="Grade" Category="Navigation Property" Type="Grade" Field="" Dependent="" Principal="Grade" Inverse="" PropertyAccessMode="PropertyAccessMode.Default" />
<Node Id = "Student.DateOfBirth" Label="DateOfBirth" Name="DateOfBirth" Category="Property Optional" Type="DateTime?" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student.G_Id" Label="G_Id" Name="G_Id" Category="Property Foreign" Type="int" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="True" IsRequired="True" IsIndexed="True" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student.Height" Label="Height" Name="Height" Category="Property Optional" Type="decimal?" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student.Photo" Label="Photo" Name="Photo" Category="Property Optional" Type="byte[]" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student.StudentName" Label="StudentName" Name="StudentName" Category="Property Optional" Type="string" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
<Node Id = "Student.Weight" Label="Weight" Name="Weight" Category="Property Optional" Type="float?" MaxLength="None" Field="" PropertyAccessMode="PropertyAccessMode.Default" BeforeSaveBehavior="PropertySaveBehavior.Save" AfterSaveBehavior="PropertySaveBehavior.Save" Annotations="" IsPrimaryKey="False" IsForeignKey="False" IsRequired="False" IsIndexed="False" IsShadow="False" IsAlternateKey="False" IsConcurrencyToken="False" IsUnicode="True" ValueGenerated="None" />
</Nodes>
<Links>
<Link Source = "IModel" Target="Grade" Category="Contains" />
<Link Source = "IModel" Target="Student" Category="Contains" />
<Link Source = "Grade" Target="Grade.Students" Category="Contains" />
<Link Source = "Grade" Target="Grade.GradeId" Category="Contains" />
<Link Source = "Grade" Target="Grade.GradeName" Category="Contains" />
<Link Source = "Grade" Target="Grade.Section" Category="Contains" />
<Link Source = "IModel" Target="Student" Category="Contains" />
<Link Source = "Student" Target="Student.Grade" Category="Contains" />
<Link Source = "Student" Target="Student.StudentId" Category="Contains" />
<Link Source="Student" Target="Grade" From="Student.G_Id" To="Grade.GradeId" Name="Student -> Grade" Annotations="" IsUnique="False" Label="1:*" Category="Foreign Key" />
<Link Source="Student" Target="Grade" From="Student.StudentId" To="Grade.GradeId" Name="Student -> Grade" Annotations="" IsUnique="False" Label="1:*" Category="Foreign Key" />
<Link Source = "Student" Target="Student.DateOfBirth" Category="Contains" />
<Link Source = "Student" Target="Student.G_Id" Category="Contains" />
<Link Source = "Student" Target="Student.Height" Category="Contains" />
<Link Source = "Student" Target="Student.Photo" Category="Contains" />
<Link Source = "Student" Target="Student.StudentName" Category="Contains" />
<Link Source = "Student" Target="Student.Weight" Category="Contains" />
</Links>
<Styles>
<Style TargetType="Node" GroupLabel="EntityType" ValueLabel="True">
<Condition Expression="HasCategory('EntityType')" />
<Setter Property="Background" Value="#FFC0C0C0" />
</Style>
<Style TargetType="Node" GroupLabel="Property Primary" ValueLabel="True">
<Condition Expression="HasCategory('Property Primary')" />
<Setter Property="Background" Value="#FF008000" />
</Style>
<Style TargetType="Node" GroupLabel="Property Optional" ValueLabel="True">
<Condition Expression="HasCategory('Property Optional')" />
<Setter Property="Background" Value="#FF808040" />
</Style>
<Style TargetType="Node" GroupLabel="Property Foreign" ValueLabel="True">
<Condition Expression="HasCategory('Property Foreign')" />
<Setter Property="Background" Value="#FF8080FF" />
</Style>
<Style TargetType="Node" GroupLabel="Property Required" ValueLabel="True">
<Condition Expression="HasCategory('Property Required')" />
<Setter Property="Background" Value="#FFC0A000" />
</Style>
<Style TargetType="Node" GroupLabel="Navigation Property" ValueLabel="True">
<Condition Expression="HasCategory('Navigation Property')" />
<Setter Property="Background" Value="#FF990000" />
</Style>
<Style TargetType="Node" GroupLabel="Navigation Collection" ValueLabel="True">
<Condition Expression="HasCategory('Navigation Collection')" />
<Setter Property="Background" Value="#FFFF3232" />
</Style>
<Style TargetType="Node" GroupLabel="Model" ValueLabel="True">
<Condition Expression="HasCategory('Model')" />
<Setter Property="Background" Value="#FFFFFFFF" />
</Style>
</Styles>
<Properties>
<Property Id="Name" Group="Model Properties" DataType="System.String" />
<Property Id="Field" Description="Backing field" Group="Model Properties" DataType="System.String" />
<Property Id="Type" Description="CLR data type" Group="Model Properties" DataType="System.String" />
<Property Id="To" Description="Source property" Group="Model Properties" DataType="System.String" />
<Property Id="From" Description="Target property" Group="Model Properties" DataType="System.String" />
<Property Id="Dependent" Description="Dependent entity" Group="Model Properties" DataType="System.String" />
<Property Id="Inverse" Description="Inverse entity" Group="Model Properties" DataType="System.String" />
<Property Id="Principal" Description="Principal entity" Group="Model Properties" DataType="System.String" />
<Property Id="Annotations" Description="Annotations" Group="Model Properties" DataType="System.String" />
<Property Id="BaseClass" Description="Base class" Group="Model Properties" DataType="System.String" />
<Property Id="ChangeTrackingStrategy" Description="Change tracking strategy" Group="Model Properties" DataType="System.String" />
<Property Id="IsUnique" Group="Model Properties" DataType="System.Boolean" />
<Property Id="IsAbstract" Group="Model Properties" DataType="System.Boolean" />
<Property Id="ProductVersion" Label="Product Version" Description="EF Core product version" Group="Model Properties" DataType="System.String" />
<Property Id="IsIndexed" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsRequired" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsPrimaryKey" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsForeignKey" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsShadow" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsAlternateKey" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsConcurrencyToken" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsIndexed" Group="Property Flags" DataType="System.Boolean" />
<Property Id="IsUnicode" Group="Property Flags" DataType="System.Boolean" />
<Property Id="ValueGenerated" Group="Property Flags" DataType="System.String" />
<Property Id="BeforeSaveBehavior" Group="Property Flags" DataType="System.String" />
<Property Id="AfterSaveBehavior" Group="Property Flags" DataType="System.String" />
<Property Id="PropertyAccessMode" Group="Property Flags" DataType="System.String" />
</Properties>
</DirectedGraph>

Loading…
Отказ
Запис