mirror of https://github.com/abpframework/abp.git
12 changed files with 40 additions and 235 deletions
@ -1,37 +0,0 @@ |
|||||
// <auto-generated />
|
|
||||
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("20170927075606_Initial_Migration")] |
|
||||
partial class Initial_Migration |
|
||||
{ |
|
||||
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<Guid>("Id") |
|
||||
.ValueGeneratedOnAdd(); |
|
||||
|
|
||||
b.Property<string>("Name"); |
|
||||
|
|
||||
b.HasKey("Id"); |
|
||||
|
|
||||
b.ToTable("Books"); |
|
||||
}); |
|
||||
#pragma warning restore 612, 618
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
using System; |
|
||||
|
|
||||
namespace Volo.Abp.EntityFrameworkCore.Tests.SecondContext.Migrations |
|
||||
{ |
|
||||
public partial class Initial_Migration : Migration |
|
||||
{ |
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.CreateTable( |
|
||||
name: "Books", |
|
||||
columns: table => new |
|
||||
{ |
|
||||
Id = table.Column<Guid>(type: "BLOB", nullable: false), |
|
||||
Name = table.Column<string>(type: "TEXT", nullable: true) |
|
||||
}, |
|
||||
constraints: table => |
|
||||
{ |
|
||||
table.PrimaryKey("PK_Books", x => x.Id); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropTable( |
|
||||
name: "Books"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,49 +0,0 @@ |
|||||
// <auto-generated />
|
|
||||
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<Guid>("Id") |
|
||||
.ValueGeneratedOnAdd(); |
|
||||
|
|
||||
b.Property<string>("Name"); |
|
||||
|
|
||||
b.HasKey("Id"); |
|
||||
|
|
||||
b.ToTable("Books"); |
|
||||
}); |
|
||||
|
|
||||
modelBuilder.Entity("Volo.Abp.EntityFrameworkCore.TestApp.SecondContext.PhoneInSecondDbContext", b => |
|
||||
{ |
|
||||
b.Property<long>("Id") |
|
||||
.ValueGeneratedOnAdd(); |
|
||||
|
|
||||
b.Property<string>("Number"); |
|
||||
|
|
||||
b.HasKey("Id"); |
|
||||
|
|
||||
b.ToTable("AppPhones"); |
|
||||
}); |
|
||||
#pragma warning restore 612, 618
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
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) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,48 +0,0 @@ |
|||||
// <auto-generated />
|
|
||||
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))] |
|
||||
partial class SecondDbContextModelSnapshot : ModelSnapshot |
|
||||
{ |
|
||||
protected override void BuildModel(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<Guid>("Id") |
|
||||
.ValueGeneratedOnAdd(); |
|
||||
|
|
||||
b.Property<string>("Name"); |
|
||||
|
|
||||
b.HasKey("Id"); |
|
||||
|
|
||||
b.ToTable("Books"); |
|
||||
}); |
|
||||
|
|
||||
modelBuilder.Entity("Volo.Abp.EntityFrameworkCore.TestApp.SecondContext.PhoneInSecondDbContext", b => |
|
||||
{ |
|
||||
b.Property<long>("Id") |
|
||||
.ValueGeneratedOnAdd(); |
|
||||
|
|
||||
b.Property<string>("Number"); |
|
||||
|
|
||||
b.HasKey("Id"); |
|
||||
|
|
||||
b.ToTable("AppPhones"); |
|
||||
}); |
|
||||
#pragma warning restore 612, 618
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore.Design; |
|
||||
|
|
||||
namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext |
|
||||
{ |
|
||||
public class SecondDbContextFactory : IDesignTimeDbContextFactory<SecondDbContext> |
|
||||
{ |
|
||||
public SecondDbContext CreateDbContext(string[] args) |
|
||||
{ |
|
||||
var builder = new DbContextOptionsBuilder<SecondDbContext>(); |
|
||||
builder.UseSqlite(@"Data Source=d:\temp\VoloAbpEfCoreTestModule.db;"); |
|
||||
return new SecondDbContext(builder.Options); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,34 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.TestApp.SecondContext; |
||||
|
using Volo.Abp.EntityFrameworkCore.TestApp.ThirdDbContext; |
||||
|
using Volo.Abp.TestApp.Domain; |
||||
|
|
||||
|
namespace Volo.Abp.EntityFrameworkCore |
||||
|
{ |
||||
|
public class TestMigrationsDbContext : AbpDbContext<TestMigrationsDbContext> |
||||
|
{ |
||||
|
public DbSet<Person> People { get; set; } |
||||
|
|
||||
|
public DbSet<City> Cities { get; set; } |
||||
|
|
||||
|
public DbSet<ThirdDbContextDummyEntity> DummyEntities { get; set; } |
||||
|
|
||||
|
public DbSet<BookInSecondDbContext> Books { get; set; } |
||||
|
|
||||
|
public TestMigrationsDbContext(DbContextOptions<TestMigrationsDbContext> options) |
||||
|
: base(options) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder) |
||||
|
{ |
||||
|
base.OnModelCreating(modelBuilder); |
||||
|
|
||||
|
modelBuilder.Entity<Phone>(b => |
||||
|
{ |
||||
|
b.HasKey(p => new { p.PersonId, p.Number }); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,15 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore.Design; |
|
||||
|
|
||||
namespace Volo.Abp.TestApp.EntityFrameworkCore |
|
||||
{ |
|
||||
public class TestAppDbContextFactory : IDesignTimeDbContextFactory<TestAppDbContext> |
|
||||
{ |
|
||||
public TestAppDbContext CreateDbContext(string[] args) |
|
||||
{ |
|
||||
var builder = new DbContextOptionsBuilder<TestAppDbContext>(); |
|
||||
builder.UseSqlite(@"Data Source=d:\temp\VoloAbpEfCoreTestModule.db;"); |
|
||||
return new TestAppDbContext(builder.Options); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue