mirror of https://github.com/abpframework/abp.git
57 changed files with 6116 additions and 267 deletions
@ -0,0 +1,80 @@ |
|||
# Virtual File Explorer Module |
|||
|
|||
## What is Virtual File Explorer Module? |
|||
|
|||
Virtual File Explorer Module provided a simple UI to view all files in [virtual file system](../Virtual-File-System.md). |
|||
|
|||
> Virtual File Explorer Module is not installed for [the startup templates](../Startup-Templates/Index.md). So, you need to manually add this module to your application. |
|||
|
|||
### Installation |
|||
|
|||
#### 1- Referencing Virtual File Explorer Module Packages |
|||
|
|||
It is recommended to use the ABP CLI to install the module, open the CMD window in the solution file (`.sln`) directory, and run the following command: |
|||
|
|||
`abp add-module Volo.VirtualFileExplorer` |
|||
|
|||
Or you can also manually install nuget package to `Acme.MyProject.Web` project: |
|||
|
|||
* Install [Volo.Abp.VirtualFileExplorer.Web](https://www.nuget.org/packages/Volo.Abp.VirtualFileExplorer.Web/) nuget package to `Acme.MyProject.Web` project. |
|||
|
|||
`Install-Package Volo.Abp.VirtualFileExplorer.Web` |
|||
|
|||
#### 2- Adding Module Dependencies |
|||
|
|||
* Open `MyProjectWebModule.cs`and add `typeof(AbpVirtualFileExplorerWebModule)` as shown below; |
|||
|
|||
```csharp |
|||
[DependsOn( |
|||
typeof(AbpVirtualFileExplorerWebModule), |
|||
typeof(MyProjectApplicationModule), |
|||
typeof(MyProjectEntityFrameworkCoreModule), |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpIdentityWebModule), |
|||
typeof(AbpAccountWebModule), |
|||
typeof(AbpAspNetCoreMvcUiBasicThemeModule) |
|||
)] |
|||
public class MyProjectWebModule : AbpModule |
|||
{ |
|||
//... |
|||
} |
|||
``` |
|||
|
|||
#### 3- Adding NPM Package |
|||
|
|||
* Open `package.json` and add `@abp/virtual-file-explorer": "^2.9.0` as shown below: |
|||
|
|||
```json |
|||
{ |
|||
"version": "1.0.0", |
|||
"name": "my-app", |
|||
"private": true, |
|||
"dependencies": { |
|||
"@abp/aspnetcore.mvc.ui.theme.basic": "^2.9.0", |
|||
"@abp/virtual-file-explorer": "^2.9.0" |
|||
} |
|||
} |
|||
``` |
|||
|
|||
Then open the command line terminal in the `Acme.MyProject.Web` project folder and run the following command: |
|||
|
|||
1. `yarn` |
|||
2. `gulp` |
|||
|
|||
That's all,Now run the application and Navigate to `/VirtualFileExplorer`. You will see virtual file explorer page: |
|||
|
|||
 |
|||
|
|||
### Options |
|||
|
|||
You can disabled virtual file explorer module via `AbpVirtualFileExplorerOptions` options: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<AbpVirtualFileExplorerOptions>(options => |
|||
{ |
|||
options.IsEnabled = false; |
|||
}); |
|||
} |
|||
``` |
|||
|
After Width: | Height: | Size: 47 KiB |
@ -0,0 +1,80 @@ |
|||
# 虚拟文件浏览器模块 |
|||
|
|||
## 什么是虚拟文件浏览器模块 |
|||
|
|||
虚拟文件浏览器模块提供了一个简单的UI来查看[虚拟文件系统](../Virtual-File-System.md)所有的文件. |
|||
|
|||
> [启动模板](../Startup-Templates/Index.md)默认并没有安装这个模块,所以你需要手动安装到应用程序. |
|||
|
|||
### 安装 |
|||
|
|||
#### 1- 引用虚拟文件浏览器模块包 |
|||
|
|||
建议使用ABP CLI安装模块,在解决方案文件 (`.sln`) 目录打开 `CMD` 窗口,运行以下命令: |
|||
|
|||
`abp add-module Volo.VirtualFileExplorer` |
|||
|
|||
或者你也可以手动安装nuget包到 `Acme.MyProject.Web` 项目: |
|||
|
|||
* 安装[Volo.Abp.VirtualFileExplorer.Web](https://www.nuget.org/packages/Volo.Abp.VirtualFileExplorer.Web/) nuget包到 `Acme.MyProject.Web` 项目. |
|||
|
|||
`Install-Package Volo.Abp.VirtualFileExplorer.Web` |
|||
|
|||
#### 2- 添加模块依赖 |
|||
|
|||
* 打开 `MyProjectWebModule.cs` 并且添加 `typeof(AbpVirtualFileExplorerWebModule)` 如下所示; |
|||
|
|||
```csharp |
|||
[DependsOn( |
|||
typeof(AbpVirtualFileExplorerWebModule), |
|||
typeof(MyProjectApplicationModule), |
|||
typeof(MyProjectEntityFrameworkCoreModule), |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpIdentityWebModule), |
|||
typeof(AbpAccountWebModule), |
|||
typeof(AbpAspNetCoreMvcUiBasicThemeModule) |
|||
)] |
|||
public class MyProjectWebModule : AbpModule |
|||
{ |
|||
//... |
|||
} |
|||
``` |
|||
|
|||
#### 3- 添加NPM包 |
|||
|
|||
* 打开 `package.json` 添加 `@abp/virtual-file-explorer": "^2.9.0` 如下所示: |
|||
|
|||
```json |
|||
{ |
|||
"version": "1.0.0", |
|||
"name": "my-app", |
|||
"private": true, |
|||
"dependencies": { |
|||
"@abp/aspnetcore.mvc.ui.theme.basic": "^2.9.0", |
|||
"@abp/virtual-file-explorer": "^2.9.0" |
|||
} |
|||
} |
|||
``` |
|||
|
|||
然后在 `Acme.MyProject.Web` 项目目录打开命令行终端运行以下命令: |
|||
|
|||
1. `yarn` |
|||
2. `gulp` |
|||
|
|||
这就是全部,运行应用程序导航到 `/VirtualFileExplorer`. 你会看到虚拟文件浏览器页面: |
|||
|
|||
 |
|||
|
|||
### 选项 |
|||
|
|||
你可以通过 `AbpVirtualFileExplorerOptions` 选项禁用虚拟文件浏览器模块: |
|||
|
|||
```csharp |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<AbpVirtualFileExplorerOptions>(options => |
|||
{ |
|||
options.IsEnabled = false; |
|||
}); |
|||
} |
|||
``` |
|||
|
After Width: | Height: | Size: 47 KiB |
@ -1,6 +1,6 @@ |
|||
namespace Volo.Abp.BlobStoring.FileSystem |
|||
{ |
|||
public interface IBlogFilePathCalculator |
|||
public interface IBlobFilePathCalculator |
|||
{ |
|||
string Calculate(BlobProviderArgs args); |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace Volo.Abp.BlobStoring |
|||
{ |
|||
public class BlobAlreadyExistsException : AbpException |
|||
{ |
|||
public BlobAlreadyExistsException() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public BlobAlreadyExistsException(string message) |
|||
: base(message) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public BlobAlreadyExistsException(string message, Exception innerException) |
|||
: base(message, innerException) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public BlobAlreadyExistsException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.BlobStoring |
|||
{ |
|||
public static class BlobContainerExtensions |
|||
{ |
|||
public static async Task SaveAsync( |
|||
this IBlobContainer container, |
|||
string name, |
|||
byte[] bytes, |
|||
bool overrideExisting = false, |
|||
CancellationToken cancellationToken = default |
|||
) |
|||
{ |
|||
using (var memoryStream = new MemoryStream(bytes)) |
|||
{ |
|||
await container.SaveAsync( |
|||
name, |
|||
memoryStream, |
|||
overrideExisting, |
|||
cancellationToken |
|||
); |
|||
} |
|||
} |
|||
|
|||
public static async Task<byte[]> GetAllBytesAsync( |
|||
this IBlobContainer container, |
|||
string name, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
using (var stream = await container.GetAsync(name, cancellationToken)) |
|||
{ |
|||
return await stream.GetAllBytesAsync(cancellationToken); |
|||
} |
|||
} |
|||
|
|||
public static async Task<byte[]> GetAllBytesOrNullAsync( |
|||
this IBlobContainer container, |
|||
string name, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var stream = await container.GetOrNullAsync(name, cancellationToken); |
|||
if (stream == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
using (stream) |
|||
{ |
|||
return await stream.GetAllBytesAsync(cancellationToken); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace Volo.Abp |
|||
{ |
|||
public class AbpShutdownException : AbpException |
|||
{ |
|||
public AbpShutdownException() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AbpShutdownException(string message) |
|||
: base(message) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AbpShutdownException(string message, Exception innerException) |
|||
: base(message, innerException) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AbpShutdownException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,27 +1,43 @@ |
|||
using System; |
|||
using System.IO; |
|||
using Volo.Abp.BlobStoring.FileSystem.TestObjects; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.BlobStoring.FileSystem |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpBlobStoringFileSystemModule) |
|||
typeof(AbpBlobStoringFileSystemModule), |
|||
typeof(AbpBlobStoringTestModule) |
|||
)] |
|||
public class AbpBlobStoringFileSystemTestModule : AbpModule |
|||
{ |
|||
private readonly string _testDirectoryPath; |
|||
|
|||
public AbpBlobStoringFileSystemTestModule() |
|||
{ |
|||
_testDirectoryPath = Path.Combine( |
|||
Path.GetTempPath(), |
|||
Guid.NewGuid().ToString("N") |
|||
); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpBlobStoringOptions>(options => |
|||
{ |
|||
options.Containers.ConfigureDefault(container => |
|||
options.Containers.ConfigureAll((containerName, containerConfiguration) => |
|||
{ |
|||
container.UseFileSystem(fileSystem => |
|||
containerConfiguration.UseFileSystem(fileSystem => |
|||
{ |
|||
fileSystem.BasePath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")); |
|||
fileSystem.BasePath = _testDirectoryPath; |
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
public override void OnApplicationShutdown(ApplicationShutdownContext context) |
|||
{ |
|||
DirectoryHelper.DeleteIfExists(_testDirectoryPath, true); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace Volo.Abp.BlobStoring.FileSystem |
|||
{ |
|||
public class FileSystemBlobContainer_Tests : BlobContainer_Tests<AbpBlobStoringFileSystemTestModule> |
|||
{ |
|||
public FileSystemBlobContainer_Tests() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
namespace Volo.Abp.BlobStoring.FileSystem.TestObjects |
|||
{ |
|||
[BlobContainerName("TestContainer")] |
|||
public class TestContainer |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Shouldly; |
|||
using Volo.Abp.BlobStoring.TestObjects; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Testing; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BlobStoring |
|||
{ |
|||
public abstract class BlobContainer_Tests<TStartupModule> : AbpIntegratedTest<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
protected IBlobContainer<TestContainer1> Container { get; } |
|||
|
|||
protected BlobContainer_Tests() |
|||
{ |
|||
Container = GetRequiredService<IBlobContainer<TestContainer1>>(); |
|||
} |
|||
|
|||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) |
|||
{ |
|||
options.UseAutofac(); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("test-blob-1")] |
|||
[InlineData("test-blob-1.txt")] |
|||
[InlineData("test-folder/test-blob-1")] |
|||
public async Task Should_Save_And_Get_Blobs(string blobName) |
|||
{ |
|||
var testContent = "test content".GetBytes(); |
|||
await Container.SaveAsync(blobName, testContent); |
|||
|
|||
var result = await Container.GetAllBytesAsync(blobName); |
|||
result.SequenceEqual(testContent).ShouldBeTrue(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Overwrite_Pre_Saved_Blob_If_Requested() |
|||
{ |
|||
var blobName = "test-blob-1"; |
|||
|
|||
var testContent = "test content".GetBytes(); |
|||
await Container.SaveAsync(blobName, testContent); |
|||
|
|||
var testContentOverwritten = "test content overwritten".GetBytes(); |
|||
await Container.SaveAsync(blobName, testContentOverwritten, true); |
|||
|
|||
var result = await Container.GetAllBytesAsync(blobName); |
|||
result.SequenceEqual(testContentOverwritten).ShouldBeTrue(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Not_Allow_To_Overwrite_Pre_Saved_Blob_By_Default() |
|||
{ |
|||
var blobName = "test-blob-1"; |
|||
|
|||
var testContent = "test content".GetBytes(); |
|||
await Container.SaveAsync(blobName, testContent); |
|||
|
|||
var testContentOverwritten = "test content overwritten".GetBytes(); |
|||
await Assert.ThrowsAsync<BlobAlreadyExistsException>(() => |
|||
Container.SaveAsync(blobName, testContentOverwritten) |
|||
); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("test-blob-1")] |
|||
[InlineData("test-blob-1.txt")] |
|||
[InlineData("test-folder/test-blob-1")] |
|||
public async Task Should_Delete_Saved_Blobs(string blobName) |
|||
{ |
|||
await Container.SaveAsync(blobName, "test content".GetBytes()); |
|||
(await Container.GetAllBytesAsync(blobName)).ShouldNotBeNull(); |
|||
|
|||
await Container.DeleteAsync(blobName); |
|||
(await Container.GetAllBytesOrNullAsync(blobName)).ShouldBeNull(); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("test-blob-1")] |
|||
[InlineData("test-blob-1.txt")] |
|||
[InlineData("test-folder/test-blob-1")] |
|||
public async Task Saved_Blobs_Should_Exists(string blobName) |
|||
{ |
|||
await Container.SaveAsync(blobName, "test content".GetBytes()); |
|||
(await Container.ExistsAsync(blobName)).ShouldBeTrue(); |
|||
|
|||
await Container.DeleteAsync(blobName); |
|||
(await Container.ExistsAsync(blobName)).ShouldBeFalse(); |
|||
} |
|||
|
|||
[Theory] |
|||
[InlineData("test-blob-1")] |
|||
[InlineData("test-blob-1.txt")] |
|||
[InlineData("test-folder/test-blob-1")] |
|||
public async Task Unknown_Blobs_Should_Not_Exists(string blobName) |
|||
{ |
|||
await Container.DeleteAsync(blobName); |
|||
(await Container.ExistsAsync(blobName)).ShouldBeFalse(); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,127 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations |
|||
{ |
|||
public partial class Added_OrganizationUnits : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpOrganizationUnits", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(nullable: true), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(nullable: true), |
|||
LastModifierId = table.Column<Guid>(nullable: true), |
|||
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ParentId = table.Column<Guid>(nullable: true), |
|||
Code = table.Column<string>(maxLength: 95, nullable: false), |
|||
DisplayName = table.Column<string>(maxLength: 128, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", |
|||
column: x => x.ParentId, |
|||
principalTable: "AbpOrganizationUnits", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpOrganizationUnitRoles", |
|||
columns: table => new |
|||
{ |
|||
RoleId = table.Column<Guid>(nullable: false), |
|||
OrganizationUnitId = table.Column<Guid>(nullable: false), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", |
|||
column: x => x.OrganizationUnitId, |
|||
principalTable: "AbpOrganizationUnits", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", |
|||
column: x => x.RoleId, |
|||
principalTable: "AbpRoles", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserOrganizationUnits", |
|||
columns: table => new |
|||
{ |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
OrganizationUnitId = table.Column<Guid>(nullable: false), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", |
|||
column: x => x.OrganizationUnitId, |
|||
principalTable: "AbpOrganizationUnits", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", |
|||
table: "AbpOrganizationUnitRoles", |
|||
columns: new[] { "RoleId", "OrganizationUnitId" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpOrganizationUnits_Code", |
|||
table: "AbpOrganizationUnits", |
|||
column: "Code"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpOrganizationUnits_ParentId", |
|||
table: "AbpOrganizationUnits", |
|||
column: "ParentId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserOrganizationUnits_UserId_OrganizationUnitId", |
|||
table: "AbpUserOrganizationUnits", |
|||
columns: new[] { "UserId", "OrganizationUnitId" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpOrganizationUnitRoles"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserOrganizationUnits"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpOrganizationUnits"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,127 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace AuthServer.Host.Migrations |
|||
{ |
|||
public partial class Added_OrganizationUnits : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpOrganizationUnits", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(nullable: true), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(nullable: true), |
|||
LastModifierId = table.Column<Guid>(nullable: true), |
|||
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ParentId = table.Column<Guid>(nullable: true), |
|||
Code = table.Column<string>(maxLength: 95, nullable: false), |
|||
DisplayName = table.Column<string>(maxLength: 128, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId", |
|||
column: x => x.ParentId, |
|||
principalTable: "AbpOrganizationUnits", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpOrganizationUnitRoles", |
|||
columns: table => new |
|||
{ |
|||
RoleId = table.Column<Guid>(nullable: false), |
|||
OrganizationUnitId = table.Column<Guid>(nullable: false), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpOrganizationUnitRoles", x => new { x.OrganizationUnitId, x.RoleId }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpOrganizationUnitRoles_AbpOrganizationUnits_OrganizationUnitId", |
|||
column: x => x.OrganizationUnitId, |
|||
principalTable: "AbpOrganizationUnits", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_AbpOrganizationUnitRoles_AbpRoles_RoleId", |
|||
column: x => x.RoleId, |
|||
principalTable: "AbpRoles", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserOrganizationUnits", |
|||
columns: table => new |
|||
{ |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
OrganizationUnitId = table.Column<Guid>(nullable: false), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserOrganizationUnits", x => new { x.OrganizationUnitId, x.UserId }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserOrganizationUnits_AbpOrganizationUnits_OrganizationUnitId", |
|||
column: x => x.OrganizationUnitId, |
|||
principalTable: "AbpOrganizationUnits", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserOrganizationUnits_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", |
|||
table: "AbpOrganizationUnitRoles", |
|||
columns: new[] { "RoleId", "OrganizationUnitId" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpOrganizationUnits_Code", |
|||
table: "AbpOrganizationUnits", |
|||
column: "Code"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpOrganizationUnits_ParentId", |
|||
table: "AbpOrganizationUnits", |
|||
column: "ParentId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserOrganizationUnits_UserId_OrganizationUnitId", |
|||
table: "AbpUserOrganizationUnits", |
|||
columns: new[] { "UserId", "OrganizationUnitId" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpOrganizationUnitRoles"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserOrganizationUnits"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpOrganizationUnits"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue