-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba728d2
commit c32a3eb
Showing
19 changed files
with
950 additions
and
60 deletions.
There are no files selected for viewing
422 changes: 422 additions & 0 deletions
422
src/Dome.Modules/XCore.Migrator/Migrations/20180112170815_addShell.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
131 changes: 131 additions & 0 deletions
131
src/Dome.Modules/XCore.Migrator/Migrations/20180112170815_addShell.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,131 @@ | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace XCore.Migrator.Migrations | ||
{ | ||
public partial class addShell : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "XCore_ShellDescriptor", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(nullable: false) | ||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), | ||
SerialNumber = table.Column<int>(nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_XCore_ShellDescriptor", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "XCore_ShellState", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(nullable: false) | ||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_XCore_ShellState", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "ShellFeature", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(nullable: false), | ||
ShellDescriptorId = table.Column<int>(nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_ShellFeature", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_ShellFeature_XCore_ShellDescriptor_ShellDescriptorId", | ||
column: x => x.ShellDescriptorId, | ||
principalTable: "XCore_ShellDescriptor", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Restrict); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "ShellParameter", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(nullable: false) | ||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), | ||
Component = table.Column<string>(nullable: true), | ||
Name = table.Column<string>(nullable: true), | ||
ShellDescriptorId = table.Column<int>(nullable: true), | ||
Value = table.Column<string>(nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_ShellParameter", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_ShellParameter_XCore_ShellDescriptor_ShellDescriptorId", | ||
column: x => x.ShellDescriptorId, | ||
principalTable: "XCore_ShellDescriptor", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Restrict); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "ShellFeatureState", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(nullable: false), | ||
EnableState = table.Column<int>(nullable: false), | ||
InstallState = table.Column<int>(nullable: false), | ||
ShellStateId = table.Column<int>(nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_ShellFeatureState", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_ShellFeatureState_XCore_ShellState_ShellStateId", | ||
column: x => x.ShellStateId, | ||
principalTable: "XCore_ShellState", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Restrict); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ShellFeature_ShellDescriptorId", | ||
table: "ShellFeature", | ||
column: "ShellDescriptorId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ShellFeatureState_ShellStateId", | ||
table: "ShellFeatureState", | ||
column: "ShellStateId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_ShellParameter_ShellDescriptorId", | ||
table: "ShellParameter", | ||
column: "ShellDescriptorId"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "ShellFeature"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "ShellFeatureState"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "ShellParameter"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "XCore_ShellState"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "XCore_ShellDescriptor"); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,14 @@ public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IS | |
} | ||
} | ||
|
||
// class MyDesignTimeServices : IDesignTimeServices | ||
// { | ||
// public void ConfigureDesignTimeServices(IServiceCollection services) | ||
// => services.AddSingleton<IMigrationsCodeGenerator, MyMigrationsCodeGenerator>() | ||
//} | ||
|
||
public class AppContextFactory : IDesignTimeDbContextFactory<AppDbContext> | ||
{ | ||
//string conString = "Data Source=www.dming.top;Database=XCore;UID=sa;[email protected];MultipleActiveResultSets=true;"; | ||
//string conString = "Data Source=192.168.8.127;Database=TongGenTongMeng;UID=Tong;PWD=123;MultipleActiveResultSets=true;"; | ||
|
||
public AppDbContext CreateDbContext(string[] args) | ||
{ | ||
var configuration = new ConfigurationBuilder() | ||
|
@@ -56,6 +59,7 @@ public AppDbContext CreateDbContext(string[] args) | |
var entityManager = new MigrationEntityManager(); //MigrationEntityManager实现了IEntityManager接口 | ||
entityManager.LoadAssemblys("XCore.Identity.EntityFrameworkCore");//加载实现了IEntityTypeConfiguration接口的类所在的程序集 | ||
entityManager.LoadAssemblys("XCore.Article.EntityFrameworkCore"); | ||
entityManager.LoadAssemblys("XCore.Environment.Shell.EntityFrameworkCore"); | ||
|
||
return new AppDbContext(optionsBuilder.Options, entityManager); | ||
} | ||
|
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
8 changes: 0 additions & 8 deletions
8
src/XCore/XCore.Environment.Shell.EntityFrameworkCore/Class1.cs
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/XCore/XCore.Environment.Shell.EntityFrameworkCore/EntityFrameworkBuilderExtensions.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,15 @@ | ||
using System; | ||
using XCore.Environment.Shell.Data; | ||
|
||
namespace XCore.Environment.Shell.EntityFrameworkCore | ||
{ | ||
public static class EntityFrameworkBuilderExtensions | ||
{ | ||
public static ShellBuilder AddEntityFrameworkStores(this ShellBuilder builder) | ||
{ | ||
builder.AddShellDescriptorStore<ShellDescriptorStore>(); | ||
builder.AddShellStateStore<ShellStateStore>(); | ||
return builder; | ||
} | ||
} | ||
} |
Oops, something went wrong.