-
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 #175 from linq2db/version3
Release 3.14.0
- Loading branch information
Showing
14 changed files
with
239 additions
and
40 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
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
93 changes: 93 additions & 0 deletions
93
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,93 @@ | ||
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<BlogBase>().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<ShadowBlogBase>().ToTable("ShadowBlogs"); | ||
} | ||
|
||
public DbSet<BlogBase> Blogs { get; set; } = null!; | ||
public DbSet<ShadowBlogBase> ShadowBlogs { get; set; } = null!; | ||
} | ||
|
||
} |
Oops, something went wrong.