Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 726c68a

Browse files
authored
Merge pull request #31 from linq2db/master
Release 2.0.4
2 parents 58d05f7 + e202054 commit 726c68a

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

Build/linq2db.Default.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.0.3</Version>
3+
<Version>2.0.4</Version>
44

55
<Description>Allows to execute Linq to DB (linq2db) queries in Entity Framework Core DbContext.</Description>
66
<Title>Linq to DB (linq2db) extensions for Entity Framework Core</Title>

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ public virtual void DefineConvertors(
391391

392392
foreach (var clrType in types)
393393
{
394+
// skipping enums
395+
if (clrType.IsEnum)
396+
continue;
397+
394398
var currentType = mappingSchema.GetDataType(clrType);
395399
if (currentType != SqlDataType.Undefined)
396400
continue;

Tests/LinqToDB.EntityFrameworkCore.Tests/JsonConverTests.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Linq;
1+
using System;
2+
using System.Linq;
23
using LinqToDB.Data;
34
using Microsoft.EntityFrameworkCore;
45
using Newtonsoft.Json;
@@ -24,9 +25,17 @@ public class EventScheduleItemBase
2425
public int Id { get; set; }
2526
public virtual LocalizedString NameLocalized { get; set; }
2627
}
28+
29+
public enum CrashEnum : byte
30+
{
31+
OneValue = 0,
32+
OtherValue = 1
33+
}
2734

2835
public class EventScheduleItem : EventScheduleItemBase
2936
{
37+
public CrashEnum CrashEnum { get; set; }
38+
public Guid GuidColumn { get; set; }
3039
}
3140

3241
public class JsonConvertContext : DbContext
@@ -58,6 +67,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5867
.HasColumnName("NameLocalized_JSON")
5968
.HasConversion(v => JsonConvert.SerializeObject(v),
6069
v => JsonConvert.DeserializeObject<LocalizedString>(v));
70+
entity.Property(e => e.CrashEnum).HasColumnType("tinyint");
71+
entity.Property(e => e.GuidColumn).HasColumnType("uniqueidentifier");
6172
});
6273
}
6374
}
@@ -86,13 +97,15 @@ public void TestJsonConvert()
8697

8798
using (var ctx = new JsonConvertContext(_options))
8899
{
100+
ctx.Database.EnsureDeleted();
89101
ctx.Database.EnsureCreated();
90102

91103
ctx.EventScheduleItems.Delete();
92104

93105
ctx.EventScheduleItems.Add(new EventScheduleItem()
94106
{
95-
NameLocalized = new LocalizedString() { English = "English", German = "German", Slovak = "Slovak" }
107+
NameLocalized = new LocalizedString() { English = "English", German = "German", Slovak = "Slovak" },
108+
GuidColumn = Guid.NewGuid()
96109
});
97110
ctx.SaveChanges();
98111

@@ -103,7 +116,9 @@ public void TestJsonConvert()
103116
.Select(p => new
104117
{
105118
p.Id,
106-
p.NameLocalized
119+
p.NameLocalized,
120+
p.CrashEnum,
121+
p.GuidColumn
107122
}).FirstOrDefault();
108123

109124
Assert.That(item.NameLocalized.English, Is.EqualTo("English"));

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
variables:
22
solution: 'linq2db.EFCore.sln'
33
build_configuration: 'Release'
4-
assemblyVersion: 2.0.3
5-
nugetVersion: 2.0.3
4+
assemblyVersion: 2.0.4
5+
nugetVersion: 2.0.4
66
artifact_nugets: 'nugets'
77

88
# build on commits to important branches (master + release branches):

0 commit comments

Comments
 (0)