Skip to content

Commit 3e23ba9

Browse files
committed
Updated EF Core samples
1 parent 0f2503a commit 3e23ba9

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
**/packages/**
66

77
*\.sln\.DotSettings\.user
8+
samples/Thinktecture\.Runtime\.Extensions\.EntityFrameworkSamples/products\.db
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
using Microsoft.EntityFrameworkCore.Storage.Converters;
1+
using System;
2+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
23

34
namespace Thinktecture.Runtime.Extensions.EntityFrameworkSamples
45
{
56
public class EnumValueConverter<TEnum, TKey> : ValueConverter<TEnum, TKey>
67
where TEnum : Enum<TEnum, TKey>
78
{
89
public EnumValueConverter()
9-
: this(default(ConverterMappingHints))
10-
{
11-
}
12-
13-
public EnumValueConverter(ConverterMappingHints hints)
14-
: base(item => item.Key, key => Enum<TEnum, TKey>.Get(key), hints)
10+
: base(item => item.Key, key => Enum<TEnum, TKey>.Get(key))
1511
{
1612
}
1713
}
18-
}
14+
}

samples/Thinktecture.Runtime.Extensions.EntityFrameworkSamples/Product.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using Thinktecture.Runtime.Extensions.Samples;
2+
using Thinktecture.Runtime.Extensions.Samples.EnumLikeClass;
33

44
namespace Thinktecture.Runtime.Extensions.EntityFrameworkSamples
55
{

samples/Thinktecture.Runtime.Extensions.EntityFrameworkSamples/ProductsDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Microsoft.EntityFrameworkCore;
2-
using Thinktecture.Runtime.Extensions.Samples;
2+
using Thinktecture.Runtime.Extensions.Samples.EnumLikeClass;
33

44
namespace Thinktecture.Runtime.Extensions.EntityFrameworkSamples
55
{

samples/Thinktecture.Runtime.Extensions.EntityFrameworkSamples/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Linq;
33
using Microsoft.EntityFrameworkCore;
44
using Serilog;
5-
using Thinktecture.Runtime.Extensions.Samples;
5+
using Thinktecture.Runtime.Extensions.Samples.EnumLikeClass;
66

77
namespace Thinktecture.Runtime.Extensions.EntityFrameworkSamples
88
{
@@ -25,7 +25,6 @@ public static void Main()
2525
{
2626
Id = Guid.NewGuid(),
2727
Name = "Pear",
28-
// checking for valid enumeration items is application logic
2928
Category = ProductCategory.Get("Invalid Category")
3029
});
3130

samples/Thinktecture.Runtime.Extensions.EntityFrameworkSamples/Thinktecture.Runtime.Extensions.EntityFrameworkSamples.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.0</TargetFramework>
3+
<TargetFramework>netcoreapp2.1</TargetFramework>
44
<OutputType>EXE</OutputType>
5+
<LangVersion>7.3</LangVersion>
56
</PropertyGroup>
67
<ItemGroup>
7-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0-preview1-final" />
8+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
89
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
910
</ItemGroup>
1011
<ItemGroup>

0 commit comments

Comments
 (0)