-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from linq2db/master
Release 5.6.0
- Loading branch information
Showing
11 changed files
with
225 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/Models/Inheritance/InheritanceContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace LinqToDB.EntityFrameworkCore.SqlServer.Tests.Models.Inheritance | ||
{ | ||
public abstract class BlogBase | ||
{ | ||
public int Id { get; set; } | ||
public string BlogType { get; set; } = null!; | ||
} | ||
|
||
public class Blog : BlogBase | ||
{ | ||
public string Url { get; set; } = null!; | ||
} | ||
|
||
public class RssBlog : BlogBase | ||
{ | ||
public string Url { get; set; } = null!; | ||
} | ||
|
||
public abstract class ShadowBlogBase | ||
{ | ||
public int Id { get; set; } | ||
public string BlogType { get; set; } = null!; | ||
} | ||
|
||
public class ShadowBlog : ShadowBlogBase | ||
{ | ||
public string Url { get; set; } = null!; | ||
} | ||
|
||
public class ShadowRssBlog : ShadowBlogBase | ||
{ | ||
public string Url { get; set; } = null!; | ||
} | ||
|
||
public class InheritanceContext : DbContext | ||
{ | ||
public InheritanceContext(DbContextOptions options) : base(options) | ||
{ | ||
|
||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.Entity<BlogBase>() | ||
.HasDiscriminator(b => b.BlogType) | ||
.HasValue<Blog>("blog_base") | ||
.HasValue<RssBlog>("blog_rss"); | ||
|
||
modelBuilder.Entity<BlogBase>() | ||
.Property(e => e.BlogType) | ||
.HasColumnName("BlogType") | ||
.HasMaxLength(200); | ||
|
||
modelBuilder.Entity<Blog>() | ||
.Property(b => b.Url) | ||
.HasColumnName("Url"); | ||
|
||
modelBuilder.Entity<RssBlog>() | ||
.Property(b => b.Url) | ||
.HasColumnName("Url"); | ||
|
||
modelBuilder.Entity<Blog>().ToTable("Blogs"); | ||
modelBuilder.Entity<RssBlog>().ToTable("Blogs"); | ||
|
||
///// | ||
|
||
modelBuilder.Entity<ShadowBlogBase>() | ||
.HasDiscriminator() | ||
.HasValue<ShadowBlog>("blog_base") | ||
.HasValue<ShadowRssBlog>("blog_rss"); | ||
|
||
modelBuilder.Entity<ShadowBlogBase>() | ||
.Property(e => e.BlogType) | ||
.HasColumnName("BlogType") | ||
.HasMaxLength(200); | ||
|
||
modelBuilder.Entity<ShadowBlog>() | ||
.Property(b => b.Url) | ||
.HasColumnName("Url"); | ||
|
||
modelBuilder.Entity<ShadowRssBlog>() | ||
.Property(b => b.Url) | ||
.HasColumnName("Url"); | ||
|
||
modelBuilder.Entity<ShadowBlog>().ToTable("ShadowBlogs"); | ||
modelBuilder.Entity<ShadowRssBlog>().ToTable("ShadowBlogs"); | ||
} | ||
|
||
public DbSet<BlogBase> Blogs { get; set; } = null!; | ||
public DbSet<ShadowBlogBase> ShadowBlogs { get; set; } = null!; | ||
} | ||
|
||
} |
Oops, something went wrong.