diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Class1.cs b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Class1.cs
deleted file mode 100644
index c11584ab78..0000000000
--- a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Class1.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace Volo.Abp.EntityFrameworkCore.Tests.SecondContext
-{
- public class Class1
- {
- }
-}
diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/20170927100405_Added_PhoneInSecondDbContext.Designer.cs b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/20170927100405_Added_PhoneInSecondDbContext.Designer.cs
new file mode 100644
index 0000000000..8330648646
--- /dev/null
+++ b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/20170927100405_Added_PhoneInSecondDbContext.Designer.cs
@@ -0,0 +1,49 @@
+//
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage;
+using Microsoft.EntityFrameworkCore.Storage.Internal;
+using System;
+using Volo.Abp.EntityFrameworkCore.TestApp.SecondContext;
+
+namespace Volo.Abp.EntityFrameworkCore.Tests.SecondContext.Migrations
+{
+ [DbContext(typeof(SecondDbContext))]
+ [Migration("20170927100405_Added_PhoneInSecondDbContext")]
+ partial class Added_PhoneInSecondDbContext
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.0.0-rtm-26452");
+
+ modelBuilder.Entity("Volo.Abp.EntityFrameworkCore.TestApp.SecondContext.BookInSecondDbContext", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.ToTable("Books");
+ });
+
+ modelBuilder.Entity("Volo.Abp.EntityFrameworkCore.TestApp.SecondContext.PhoneInSecondDbContext", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Number");
+
+ b.HasKey("Id");
+
+ b.ToTable("AppPhones");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/20170927100405_Added_PhoneInSecondDbContext.cs b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/20170927100405_Added_PhoneInSecondDbContext.cs
new file mode 100644
index 0000000000..52512c2e55
--- /dev/null
+++ b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/20170927100405_Added_PhoneInSecondDbContext.cs
@@ -0,0 +1,20 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using System;
+using System.Collections.Generic;
+
+namespace Volo.Abp.EntityFrameworkCore.Tests.SecondContext.Migrations
+{
+ public partial class Added_PhoneInSecondDbContext : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ /* SecondDbContext depends on TestAppDbContext,
+ so no need to add migration for phones since TestAppDbContext already contains it */
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/SecondDbContextModelSnapshot.cs b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/SecondDbContextModelSnapshot.cs
index 7db0171e28..fb6518483a 100644
--- a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/SecondDbContextModelSnapshot.cs
+++ b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Migrations/SecondDbContextModelSnapshot.cs
@@ -30,6 +30,18 @@ namespace Volo.Abp.EntityFrameworkCore.Tests.SecondContext.Migrations
b.ToTable("Books");
});
+
+ modelBuilder.Entity("Volo.Abp.EntityFrameworkCore.TestApp.SecondContext.PhoneInSecondDbContext", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Number");
+
+ b.HasKey("Id");
+
+ b.ToTable("AppPhones");
+ });
#pragma warning restore 612, 618
}
}
diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs
new file mode 100644
index 0000000000..7c4c317c00
--- /dev/null
+++ b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/PhoneInSecondDbContext.cs
@@ -0,0 +1,11 @@
+using System.ComponentModel.DataAnnotations.Schema;
+using Volo.Abp.Domain.Entities;
+
+namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
+{
+ [Table("AppPhones")]
+ public class PhoneInSecondDbContext : AggregateRoot
+ {
+ public virtual string Number { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondDbContext.cs b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondDbContext.cs
index 40c05832a4..d2b54bc699 100644
--- a/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondDbContext.cs
+++ b/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondDbContext.cs
@@ -6,6 +6,8 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
{
public DbSet Books { get; set; }
+ public DbSet Phones { get; set; }
+
public SecondDbContext(DbContextOptions options)
: base(options)
{
diff --git a/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Basic_Repository_Tests.cs b/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Basic_Repository_Tests.cs
index a3d33b4f71..3c2edb33f9 100644
--- a/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Basic_Repository_Tests.cs
+++ b/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Basic_Repository_Tests.cs
@@ -14,11 +14,13 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories
{
private readonly IRepository _personRepository;
private readonly IRepository _bookRepository;
+ private readonly IRepository _phoneInSecondDbContextRepository;
public Basic_Repository_Tests()
{
_personRepository = ServiceProvider.GetRequiredService>();
_bookRepository = ServiceProvider.GetRequiredService>();
+ _phoneInSecondDbContextRepository = ServiceProvider.GetRequiredService>();
}
[Fact]
@@ -32,6 +34,12 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories
{
_bookRepository.GetList().Any().ShouldBeTrue();
}
+
+ [Fact]
+ public void GetPhoneInSecondDbContextList()
+ {
+ _phoneInSecondDbContextRepository.GetList().Any().ShouldBeTrue();
+ }
[Fact]
public async Task InsertAsync()