Skip to content

Commit c3a0fdf

Browse files
committed
.Net 10
1 parent c73baf9 commit c3a0fdf

File tree

77 files changed

+4441
-784
lines changed

Some content is hidden

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

77 files changed

+4441
-784
lines changed

.github/workflows/.net-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup .NET Core
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 8.0.100
27+
dotnet-version: 10.0.100
2828

2929
- name: Tests
3030
run: dotnet test EntityFrameworkCore.SqlServer.SimpleBulks.Tests/EntityFrameworkCore.SqlServer.SimpleBulks.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

.github/workflows/.net-test-connection-extensions-discriminator-enabled.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup .NET Core
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 8.0.100
27+
dotnet-version: 10.0.100
2828

2929
- name: Tests
3030
run: dotnet test EntityFrameworkCore.SqlServer.SimpleBulks.Tests/EntityFrameworkCore.SqlServer.SimpleBulks.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

.github/workflows/.net-test-connection-extensions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup .NET Core
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 8.0.100
27+
dotnet-version: 10.0.100
2828

2929
- name: Tests
3030
run: dotnet test EntityFrameworkCore.SqlServer.SimpleBulks.Tests/EntityFrameworkCore.SqlServer.SimpleBulks.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

.github/workflows/.net-test-dbcontext-extensions-discriminator-enabled.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup .NET Core
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 8.0.100
27+
dotnet-version: 10.0.100
2828

2929
- name: Tests
3030
run: dotnet test EntityFrameworkCore.SqlServer.SimpleBulks.Tests/EntityFrameworkCore.SqlServer.SimpleBulks.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

.github/workflows/.net-test-dbcontext-extensions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup .NET Core
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 8.0.100
27+
dotnet-version: 10.0.100
2828

2929
- name: Tests
3030
run: dotnet test EntityFrameworkCore.SqlServer.SimpleBulks.Tests/EntityFrameworkCore.SqlServer.SimpleBulks.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

src/DbContextExtensionsExamples/DemoDbContext.cs

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using Microsoft.EntityFrameworkCore;
33
using Microsoft.EntityFrameworkCore.Diagnostics;
44
using System;
5-
using System.ComponentModel.DataAnnotations;
6-
using System.ComponentModel.DataAnnotations.Schema;
75

86
namespace DbContextExtensionsExamples;
97

@@ -17,12 +15,22 @@ public class DemoDbContext : DbContext
1715

1816
public DbSet<ConfigurationEntry> ConfigurationEntries { get; set; }
1917

20-
public DbSet<Order> Orders { get; set; }
21-
2218
public DbSet<Blog> Blogs { get; set; }
2319

2420
public DbSet<RssBlog> RssBlogs { get; set; }
2521

22+
public DbSet<ComplexTypeOrder> ComplexTypeOrders { get; set; }
23+
24+
public DbSet<OwnedTypeOrder> OwnedTypeOrders { get; set; }
25+
26+
public DbSet<ComplexOwnedTypeOrder> ComplexOwnedTypeOrders { get; set; }
27+
28+
public DbSet<JsonComplexTypeOrder> JsonComplexTypeOrders { get; set; }
29+
30+
public DbSet<JsonOwnedTypeOrder> JsonOwnedTypeOrders { get; set; }
31+
32+
public DbSet<JsonComplexOwnedTypeOrder> JsonComplexOwnedTypeOrders { get; set; }
33+
2634
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
2735
{
2836
optionsBuilder.UseSqlServer(_connectionString);
@@ -42,35 +50,50 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
4250
modelBuilder.Entity<ConfigurationEntry>().Property(x => x.Id).HasColumnName("Id1");
4351
modelBuilder.Entity<ConfigurationEntry>().Property(x => x.SeasonAsString).HasConversion(v => v.ToString(), v => (Season)Enum.Parse(typeof(Season), v));
4452

53+
modelBuilder.Entity<JsonComplexTypeOrder>().ComplexProperty(x => x.ShippingAddress, x =>
54+
{
55+
x.ToJson();
56+
//x.ToJson("xxx").HasColumnType("json");
57+
x.ComplexProperty(y => y.Location, y =>
58+
{
59+
y.HasJsonPropertyName("xxx");
60+
});
61+
});
62+
63+
modelBuilder.Entity<JsonOwnedTypeOrder>().OwnsOne(x => x.ShippingAddress, x =>
64+
{
65+
x.ToJson();
66+
//x.ToJson("xxx").HasColumnType("json");
67+
x.OwnsOne(y => y.Location, y =>
68+
{
69+
y.HasJsonPropertyName("xxx");
70+
});
71+
});
72+
73+
modelBuilder.Entity<JsonComplexOwnedTypeOrder>().ComplexProperty(x => x.ComplexShippingAddress, x =>
74+
{
75+
x.ToJson();
76+
//x.ToJson("xxx").HasColumnType("json");
77+
x.ComplexProperty(y => y.Location, y =>
78+
{
79+
y.HasJsonPropertyName("xxx");
80+
});
81+
});
82+
83+
modelBuilder.Entity<JsonComplexOwnedTypeOrder>().OwnsOne(x => x.OwnedShippingAddress, x =>
84+
{
85+
x.ToJson();
86+
//x.ToJson("xxx").HasColumnType("json");
87+
x.OwnsOne(y => y.Location, y =>
88+
{
89+
y.HasJsonPropertyName("xxx");
90+
});
91+
});
92+
4593
base.OnModelCreating(modelBuilder);
4694
}
4795
}
4896

49-
public class Order
50-
{
51-
public int Id { get; set; }
52-
53-
[Required]
54-
public Address ShippingAddress { get; set; }
55-
}
56-
57-
[ComplexType]
58-
public class Address
59-
{
60-
public string Street { get; set; }
61-
62-
[Required]
63-
public Location Location { get; set; }
64-
}
65-
66-
[ComplexType]
67-
public class Location
68-
{
69-
public double Lat { get; set; }
70-
71-
public double Lng { get; set; }
72-
}
73-
7497
public class Blog
7598
{
7699
public int BlogId { get; set; }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace DbContextExtensionsExamples.Entities;
4+
5+
public class ComplexOwnedTypeOrder
6+
{
7+
public int Id { get; set; }
8+
9+
[Required]
10+
public ComplexTypeAddress ComplexShippingAddress { get; set; }
11+
12+
[Required]
13+
public OwnedTypeAddress OwnedShippingAddress { get; set; }
14+
}
15+
16+
public class JsonComplexOwnedTypeOrder
17+
{
18+
public int Id { get; set; }
19+
20+
[Required]
21+
public ComplexTypeAddress ComplexShippingAddress { get; set; }
22+
23+
[Required]
24+
public OwnedTypeAddress OwnedShippingAddress { get; set; }
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
4+
namespace DbContextExtensionsExamples.Entities;
5+
6+
public class ComplexTypeOrder
7+
{
8+
public int Id { get; set; }
9+
10+
[Required]
11+
public ComplexTypeAddress ShippingAddress { get; set; }
12+
}
13+
14+
[ComplexType]
15+
public class ComplexTypeAddress
16+
{
17+
public string Street { get; set; }
18+
19+
public ComplexTypeLocation Location { get; set; }
20+
}
21+
22+
[ComplexType]
23+
public class ComplexTypeLocation
24+
{
25+
public double Lat { get; set; }
26+
27+
public double Lng { get; set; }
28+
}
29+
30+
public class JsonComplexTypeOrder
31+
{
32+
public int Id { get; set; }
33+
34+
[Required]
35+
public ComplexTypeAddress ShippingAddress { get; set; }
36+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Microsoft.EntityFrameworkCore;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace DbContextExtensionsExamples.Entities;
5+
6+
public class OwnedTypeOrder
7+
{
8+
public int Id { get; set; }
9+
10+
[Required]
11+
public OwnedTypeAddress ShippingAddress { get; set; }
12+
}
13+
14+
[Owned]
15+
public class OwnedTypeAddress
16+
{
17+
public string Street { get; set; }
18+
19+
[Required]
20+
public OwnedTypeLocation Location { get; set; }
21+
}
22+
23+
[Owned]
24+
public class OwnedTypeLocation
25+
{
26+
public double Lat { get; set; }
27+
28+
public double Lng { get; set; }
29+
}
30+
31+
public class JsonOwnedTypeOrder
32+
{
33+
public int Id { get; set; }
34+
35+
[Required]
36+
public OwnedTypeAddress ShippingAddress { get; set; }
37+
}

src/DbContextExtensionsExamples/Migrations/20251024140719_Init.Designer.cs

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)