Skip to content

Commit c570f64

Browse files
authored
Merge pull request #49 from koenbeuk/updated-samples
Updated samples dependency version
2 parents f3780f2 + ddde03e commit c570f64

103 files changed

Lines changed: 156 additions & 34 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

EntityFrameworkCore.Triggered.Samples.sln

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,56 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.30309.148
55
MinimumVisualStudioVersion = 15.0.26124.0
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "1 - HelloWorld", "samples\1 - HelloWorld\1 - HelloWorld.csproj", "{CEAF0F5D-718D-4C66-914A-2ADF4309C760}"
7-
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "2 - PrimarySchool", "samples\2 - PrimarySchool\2 - PrimarySchool.csproj", "{F924D036-DBA3-49FA-9654-EC30E4597C21}"
9-
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "3 - StudentManagerAspNetCore", "samples\3 - StudentManagerAspNetCore\3 - StudentManagerAspNetCore.csproj", "{5EFFD8A3-9DC6-4BB5-A557-EA737B6B134D}"
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v1", "v1", "{2ED7275D-E1AD-440A-A29F-05B2C230EDE1}"
7+
ProjectSection(SolutionItems) = preProject
8+
samples\v1\Directory.Build.props = samples\v1\Directory.Build.props
9+
EndProjectSection
1110
EndProject
12-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FBBD1EA1-974D-40AB-8B78-A1DBEF86D6E0}"
11+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "v2", "v2", "{AC9B0288-2594-4082-94C2-856993671227}"
1312
ProjectSection(SolutionItems) = preProject
14-
samples\Directory.Build.props = samples\Directory.Build.props
13+
samples\v2\Directory.Build.props = samples\v2\Directory.Build.props
1514
EndProjectSection
1615
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "1 - HelloWorld", "samples\v2\1 - HelloWorld\1 - HelloWorld.csproj", "{5F1EFBE7-8EAB-4E1C-AAB8-CB0364D2794D}"
17+
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "2 - PrimarySchool", "samples\v2\2 - PrimarySchool\2 - PrimarySchool.csproj", "{786217A1-3893-4319-A6B3-B88281554BEA}"
19+
EndProject
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "3 - StudentManagerAspNetCore", "samples\v2\3 - StudentManagerAspNetCore\3 - StudentManagerAspNetCore.csproj", "{D2630FBC-962F-44D8-AC1B-011142E850C2}"
21+
EndProject
22+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "1 - HelloWorld", "samples\v1\1 - HelloWorld\1 - HelloWorld.csproj", "{0A96270A-00CB-4CE2-8F30-4355277FC180}"
23+
EndProject
1724
Global
1825
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1926
Debug|Any CPU = Debug|Any CPU
2027
Release|Any CPU = Release|Any CPU
2128
EndGlobalSection
2229
GlobalSection(ProjectConfigurationPlatforms) = postSolution
23-
{CEAF0F5D-718D-4C66-914A-2ADF4309C760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24-
{CEAF0F5D-718D-4C66-914A-2ADF4309C760}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{CEAF0F5D-718D-4C66-914A-2ADF4309C760}.Release|Any CPU.ActiveCfg = Release|Any CPU
26-
{CEAF0F5D-718D-4C66-914A-2ADF4309C760}.Release|Any CPU.Build.0 = Release|Any CPU
27-
{F924D036-DBA3-49FA-9654-EC30E4597C21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28-
{F924D036-DBA3-49FA-9654-EC30E4597C21}.Debug|Any CPU.Build.0 = Debug|Any CPU
29-
{F924D036-DBA3-49FA-9654-EC30E4597C21}.Release|Any CPU.ActiveCfg = Release|Any CPU
30-
{F924D036-DBA3-49FA-9654-EC30E4597C21}.Release|Any CPU.Build.0 = Release|Any CPU
31-
{5EFFD8A3-9DC6-4BB5-A557-EA737B6B134D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32-
{5EFFD8A3-9DC6-4BB5-A557-EA737B6B134D}.Debug|Any CPU.Build.0 = Debug|Any CPU
33-
{5EFFD8A3-9DC6-4BB5-A557-EA737B6B134D}.Release|Any CPU.ActiveCfg = Release|Any CPU
34-
{5EFFD8A3-9DC6-4BB5-A557-EA737B6B134D}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{5F1EFBE7-8EAB-4E1C-AAB8-CB0364D2794D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{5F1EFBE7-8EAB-4E1C-AAB8-CB0364D2794D}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{5F1EFBE7-8EAB-4E1C-AAB8-CB0364D2794D}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{5F1EFBE7-8EAB-4E1C-AAB8-CB0364D2794D}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{786217A1-3893-4319-A6B3-B88281554BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{786217A1-3893-4319-A6B3-B88281554BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{786217A1-3893-4319-A6B3-B88281554BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
37+
{786217A1-3893-4319-A6B3-B88281554BEA}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{D2630FBC-962F-44D8-AC1B-011142E850C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{D2630FBC-962F-44D8-AC1B-011142E850C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{D2630FBC-962F-44D8-AC1B-011142E850C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{D2630FBC-962F-44D8-AC1B-011142E850C2}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{0A96270A-00CB-4CE2-8F30-4355277FC180}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{0A96270A-00CB-4CE2-8F30-4355277FC180}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{0A96270A-00CB-4CE2-8F30-4355277FC180}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{0A96270A-00CB-4CE2-8F30-4355277FC180}.Release|Any CPU.Build.0 = Release|Any CPU
3546
EndGlobalSection
3647
GlobalSection(SolutionProperties) = preSolution
3748
HideSolutionNode = FALSE
3849
EndGlobalSection
50+
GlobalSection(NestedProjects) = preSolution
51+
{5F1EFBE7-8EAB-4E1C-AAB8-CB0364D2794D} = {AC9B0288-2594-4082-94C2-856993671227}
52+
{786217A1-3893-4319-A6B3-B88281554BEA} = {AC9B0288-2594-4082-94C2-856993671227}
53+
{D2630FBC-962F-44D8-AC1B-011142E850C2} = {AC9B0288-2594-4082-94C2-856993671227}
54+
{0A96270A-00CB-4CE2-8F30-4355277FC180} = {2ED7275D-E1AD-440A-A29F-05B2C230EDE1}
55+
EndGlobalSection
3956
GlobalSection(ExtensibilityGlobals) = postSolution
4057
SolutionGuid = {4A731CF3-9CD6-4513-9BDD-EB8854C51A0B}
4158
EndGlobalSection
File renamed without changes.
File renamed without changes.

samples/1 - HelloWorld/Triggers/StudentAssignRegistrationDate.cs renamed to samples/v1/1 - HelloWorld/Triggers/StudentAssignRegistrationDate.cs

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<EFCoreTriggeredPackageVersion Condition=" '$(EFCoreTriggeredPackageVersion )'=='' ">1.0.0-beta.2</EFCoreTriggeredPackageVersion >
3+
<EFCoreTriggeredPackageVersion Condition=" '$(EFCoreTriggeredPackageVersion )'=='' ">1.0.0</EFCoreTriggeredPackageVersion >
44
</PropertyGroup>
55
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<RootNamespace>HelloWorld</RootNamespace>
7+
<Nullable>disable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="EntityFrameworkCore.Triggered" Version="$(EFCoreTriggeredPackageVersion)" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCorePackageVersion)" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using EntityFrameworkCore.Triggered;
7+
using Microsoft.EntityFrameworkCore;
8+
9+
namespace PrimarySchool
10+
{
11+
public class Student
12+
{
13+
public int Id { get; set; }
14+
15+
public string DisplayName { get; set; }
16+
17+
public DateTime RegistrationDate { get; set; }
18+
}
19+
20+
public class ApplicationContext : DbContext
21+
{
22+
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
23+
{
24+
optionsBuilder
25+
.UseInMemoryDatabase("HelloWorld")
26+
.UseTriggers(triggerOptions => {
27+
triggerOptions.AddTrigger<Triggers.StudentAssignRegistrationDate>();
28+
});
29+
30+
base.OnConfiguring(optionsBuilder);
31+
}
32+
33+
public DbSet<Student> Students { get; set; }
34+
}
35+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
namespace PrimarySchool
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
var applicationContext = new ApplicationContext();
11+
12+
applicationContext.Students.Add(new Student {
13+
Id = 1,
14+
DisplayName = "Joe"
15+
});
16+
17+
applicationContext.SaveChanges();
18+
19+
var joe = applicationContext.Students.Find(1);
20+
Console.WriteLine($"Joe was registered on: {joe.RegistrationDate}");
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)