Browse Source
* add exten grant_type Portal(openiddict、identityserver) * add entity enterprise(platform)pull/827/head 7.1.1
36 changed files with 3217 additions and 222 deletions
@ -0,0 +1,868 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LY.MicroService.Platform.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Platform.EntityFrameworkCore.Migrations |
|||
{ |
|||
[DbContext(typeof(PlatformMigrationsDbContext))] |
|||
[Migration("20230506071509_Add-Portal-Login")] |
|||
partial class AddPortalLogin |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("ProductVersion", "7.0.2") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Code"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name"); |
|||
|
|||
b.ToTable("AppPlatformDatas", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowBeNull") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(true); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid>("DataId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("DefaultValue") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DefaultValue"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("ValueType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("DataId"); |
|||
|
|||
b.HasIndex("Name"); |
|||
|
|||
b.ToTable("AppPlatformDataItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid>("DataId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("Redirect") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Redirect"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformLayouts", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasMaxLength(23) |
|||
.HasColumnType("varchar(23)") |
|||
.HasColumnName("Code"); |
|||
|
|||
b.Property<string>("Component") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Component"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("LayoutId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("Redirect") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Redirect"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("RoleName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("RoleName"); |
|||
|
|||
b.Property<bool>("Startup") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleName", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformRoleMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("AliasName") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("AliasName"); |
|||
|
|||
b.Property<string>("Color") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Color"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<string>("Icon") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("Icon"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformUserFavoriteMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("Startup") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformUserMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.Package", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Authors") |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("Authors"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("ForceUpdate") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("Level") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Note") |
|||
.IsRequired() |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Note"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Version"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "Version"); |
|||
|
|||
b.ToTable("AppPlatformPackages", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.PackageBlob", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Authors") |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("Authors"); |
|||
|
|||
b.Property<string>("ContentType") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("ContentType"); |
|||
|
|||
b.Property<DateTime>("CreatedAt") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<int>("DownloadCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("License") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("License"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid>("PackageId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("SHA256") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("SHA256"); |
|||
|
|||
b.Property<long?>("Size") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Summary") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Summary"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<DateTime?>("UpdatedAt") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("Url") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("Url"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("PackageId", "Name"); |
|||
|
|||
b.ToTable("AppPlatformPackageBlobs", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Portal.Enterprise", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Address") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Address"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("EnglishName") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("EnglishName"); |
|||
|
|||
b.Property<DateTime?>("ExpirationDate") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("LegalMan") |
|||
.HasMaxLength(60) |
|||
.HasColumnType("varchar(60)") |
|||
.HasColumnName("LegalMan"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("OrganizationCode") |
|||
.HasMaxLength(16) |
|||
.HasColumnType("varchar(16)") |
|||
.HasColumnName("OrganizationCode"); |
|||
|
|||
b.Property<string>("RegistrationCode") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("RegistrationCode"); |
|||
|
|||
b.Property<DateTime?>("RegistrationDate") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("TaxCode") |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("TaxCode"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformEnterprises", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Datas.Data", null) |
|||
.WithMany("Items") |
|||
.HasForeignKey("DataId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.PackageBlob", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Packages.Package", "Package") |
|||
.WithMany("Blobs") |
|||
.HasForeignKey("PackageId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("Package"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => |
|||
{ |
|||
b.Navigation("Items"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.Package", b => |
|||
{ |
|||
b.Navigation("Blobs"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Platform.EntityFrameworkCore.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class AddPortalLogin : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AppPlatformEnterprises", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
Name = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
EnglishName = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Address = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
LegalMan = table.Column<string>(type: "varchar(60)", maxLength: 60, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
TaxCode = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
OrganizationCode = table.Column<string>(type: "varchar(16)", maxLength: 16, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
RegistrationCode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
RegistrationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
ExpirationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AppPlatformEnterprises", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AppPlatformEnterprises"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,873 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LY.MicroService.Platform.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Platform.EntityFrameworkCore.Migrations |
|||
{ |
|||
[DbContext(typeof(PlatformMigrationsDbContext))] |
|||
[Migration("20230509024453_Add-Logo-Property-With-Portal")] |
|||
partial class AddLogoPropertyWithPortal |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("ProductVersion", "7.0.2") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Code"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name"); |
|||
|
|||
b.ToTable("AppPlatformDatas", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowBeNull") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(true); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid>("DataId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("DefaultValue") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DefaultValue"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("ValueType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("DataId"); |
|||
|
|||
b.HasIndex("Name"); |
|||
|
|||
b.ToTable("AppPlatformDataItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid>("DataId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("Redirect") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Redirect"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformLayouts", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasMaxLength(23) |
|||
.HasColumnType("varchar(23)") |
|||
.HasColumnName("Code"); |
|||
|
|||
b.Property<string>("Component") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Component"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("LayoutId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("Redirect") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Redirect"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("RoleName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("RoleName"); |
|||
|
|||
b.Property<bool>("Startup") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleName", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformRoleMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("AliasName") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("AliasName"); |
|||
|
|||
b.Property<string>("Color") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Color"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<string>("Icon") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("Icon"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformUserFavoriteMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("Startup") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformUserMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.Package", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Authors") |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("Authors"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("ForceUpdate") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("Level") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Note") |
|||
.IsRequired() |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Note"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Version"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "Version"); |
|||
|
|||
b.ToTable("AppPlatformPackages", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.PackageBlob", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Authors") |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("Authors"); |
|||
|
|||
b.Property<string>("ContentType") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("ContentType"); |
|||
|
|||
b.Property<DateTime>("CreatedAt") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<int>("DownloadCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("License") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("License"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid>("PackageId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("SHA256") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("SHA256"); |
|||
|
|||
b.Property<long?>("Size") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Summary") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Summary"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<DateTime?>("UpdatedAt") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("Url") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("Url"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("PackageId", "Name"); |
|||
|
|||
b.ToTable("AppPlatformPackageBlobs", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Portal.Enterprise", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Address") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Address"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("EnglishName") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("EnglishName"); |
|||
|
|||
b.Property<DateTime?>("ExpirationDate") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("LegalMan") |
|||
.HasMaxLength(60) |
|||
.HasColumnType("varchar(60)") |
|||
.HasColumnName("LegalMan"); |
|||
|
|||
b.Property<string>("Logo") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("Logo"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("OrganizationCode") |
|||
.HasMaxLength(16) |
|||
.HasColumnType("varchar(16)") |
|||
.HasColumnName("OrganizationCode"); |
|||
|
|||
b.Property<string>("RegistrationCode") |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("RegistrationCode"); |
|||
|
|||
b.Property<DateTime?>("RegistrationDate") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("TaxCode") |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("TaxCode"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformEnterprises", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Datas.Data", null) |
|||
.WithMany("Items") |
|||
.HasForeignKey("DataId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.PackageBlob", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Packages.Package", "Package") |
|||
.WithMany("Blobs") |
|||
.HasForeignKey("PackageId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("Package"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => |
|||
{ |
|||
b.Navigation("Items"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Packages.Package", b => |
|||
{ |
|||
b.Navigation("Blobs"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Platform.EntityFrameworkCore.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class AddLogoPropertyWithPortal : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Logo", |
|||
table: "AppPlatformEnterprises", |
|||
type: "varchar(512)", |
|||
maxLength: 512, |
|||
nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "Logo", |
|||
table: "AppPlatformEnterprises"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,67 +1,69 @@ |
|||
# LINGYUN.Abp.Elsa.Notifications |
|||
|
|||
工作流通知集成, 当工作流触发后, 发布相应事件通知 |
|||
|
|||
## 可用状态 |
|||
|
|||
* Faulted: 工作流执行出现错误 |
|||
* Cancelled: 工作流取消 |
|||
* Completed: 工作流执行完毕 |
|||
* Suspended: 工作流暂停 |
|||
|
|||
|
|||
## 配置使用 |
|||
|
|||
```csharp |
|||
|
|||
[DependsOn( |
|||
typeof(AbpElsaNotificationsModule) |
|||
)] |
|||
public class YouProjectModule : AbpModule |
|||
{ |
|||
} |
|||
``` |
|||
|
|||
```csharp |
|||
// 定义通知 |
|||
public class DemoNotificationDefinitionProvider : NotificationDefinitionProvider |
|||
{ |
|||
public override void Define(INotificationDefinitionContext context) |
|||
{ |
|||
var demoGroup = context.AddGroup("Group"); |
|||
|
|||
// 由于通知的多样性, 需要使用模板消息来传递数据 |
|||
demoGroup.AddNotification("Faulted") |
|||
.WithTemplate(template => { }); |
|||
demoGroup.AddNotification("Cancelled") |
|||
.WithTemplate(template => { }); |
|||
demoGroup.AddNotification("Suspended") |
|||
.WithTemplate(template => { }); |
|||
demoGroup.AddNotification("Completed") |
|||
.WithTemplate(template => { }); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
```csharp |
|||
|
|||
// 定义工作流 |
|||
public class DemoWorkflow : IWorkflow |
|||
{ |
|||
public void Build(IWorkflowBuilder builder) |
|||
{ |
|||
builder |
|||
.WithFaultedNotification("Faulted") |
|||
.WithCancelledNotification("Cancelled") |
|||
.WithSuspendedNotification("Suspended") |
|||
.WithCompletedNotification("Completed") |
|||
.SetVariable("demo", context => |
|||
{ |
|||
// 可传递自定义参数, 将作为瞬时变量写入到发布的通知数据中 |
|||
# LINGYUN.Abp.Elsa.Notifications |
|||
|
|||
工作流通知集成, 当工作流触发后, 发布相应事件通知 |
|||
|
|||
## 可用状态 |
|||
|
|||
* Faulted: 工作流执行出现错误 |
|||
* Cancelled: 工作流取消 |
|||
* Completed: 工作流执行完毕 |
|||
* Suspended: 工作流暂停 |
|||
|
|||
|
|||
## 配置使用 |
|||
|
|||
```csharp |
|||
|
|||
[DependsOn( |
|||
typeof(AbpElsaNotificationsModule) |
|||
)] |
|||
public class YouProjectModule : AbpModule |
|||
{ |
|||
} |
|||
``` |
|||
|
|||
```csharp |
|||
// 定义通知 |
|||
public class DemoNotificationDefinitionProvider : NotificationDefinitionProvider |
|||
{ |
|||
public override void Define(INotificationDefinitionContext context) |
|||
{ |
|||
var demoGroup = context.AddGroup("Group"); |
|||
|
|||
// 由于通知的多样性, 需要使用模板消息来传递数据 |
|||
demoGroup.AddNotification("Faulted") |
|||
.WithTemplate(template => { }); |
|||
demoGroup.AddNotification("Cancelled") |
|||
.WithTemplate(template => { }); |
|||
demoGroup.AddNotification("Suspended") |
|||
.WithTemplate(template => { }); |
|||
demoGroup.AddNotification("Completed") |
|||
.WithTemplate(template => { }); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
```csharp |
|||
|
|||
// 定义工作流 |
|||
public class DemoWorkflow : IWorkflow |
|||
{ |
|||
public void Build(IWorkflowBuilder builder) |
|||
{ |
|||
builder |
|||
.WithFaultedNotification("Faulted") |
|||
.WithCancelledNotification("Cancelled") |
|||
.WithSuspendedNotification("Suspended") |
|||
.WithCompletedNotification("Completed") |
|||
.SetVariable("demo", context => |
|||
{ |
|||
// 可传递自定义参数, 将作为瞬时变量写入到发布的通知数据中 |
|||
context.WithNotificationData("demo", "demo"); |
|||
}) |
|||
.WriteLine("Start a workflow.") |
|||
.WriteLine("Workflow finished."); |
|||
} |
|||
} |
|||
// 自定义用于发布通知的租户标识 |
|||
context.WithNotificationTenantId(Guid.NewGuid()); |
|||
}) |
|||
.WriteLine("Start a workflow.") |
|||
.WriteLine("Workflow finished."); |
|||
} |
|||
} |
|||
``` |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,19 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="$(VoloAbpPackageVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\platform\LINGYUN.Platform.Domain\LINGYUN.Platform.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,40 @@ |
|||
using LINGYUN.Platform; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.IdentityServer.Localization; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.IdentityServer.Portal; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpIdentityServerDomainModule), |
|||
typeof(PlatformDomainModule))] |
|||
public class AbpIdentityServerPortalModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var configuration = context.Services.GetConfiguration(); |
|||
|
|||
PreConfigure<IIdentityServerBuilder>(builder => |
|||
{ |
|||
builder.AddExtensionGrantValidator<PortalGrantValidator>(); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpIdentityServerPortalModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<AbpIdentityServerResource>() |
|||
.AddVirtualJson("/LINGYUN/Abp/IdentityServer/Portal/Localization"); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,255 @@ |
|||
using IdentityModel; |
|||
using IdentityServer4.Configuration; |
|||
using IdentityServer4.Events; |
|||
using IdentityServer4.Models; |
|||
using IdentityServer4.Services; |
|||
using IdentityServer4.Validation; |
|||
using LINGYUN.Platform.Portal; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.Extensions.Logging; |
|||
using Microsoft.Extensions.Options; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Security.Claims; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.Security.Claims; |
|||
using Volo.Abp.Uow; |
|||
using static IdentityModel.OidcConstants; |
|||
using IdentityUser = Volo.Abp.Identity.IdentityUser; |
|||
|
|||
namespace LINGYUN.Abp.IdentityServer.Portal; |
|||
public class PortalGrantValidator : IExtensionGrantValidator |
|||
{ |
|||
public const string ProviderName = "portal"; |
|||
public string GrantType => ProviderName; |
|||
|
|||
private readonly ILogger<PortalGrantValidator> _logger; |
|||
|
|||
private readonly IdentityServerOptions _options; |
|||
|
|||
private readonly IEventService _events; |
|||
private readonly IResourceOwnerPasswordValidator _resourceOwnerValidator; |
|||
private readonly IdentitySecurityLogManager _identitySecurityLogManager; |
|||
private readonly UserManager<IdentityUser> _userManager; |
|||
|
|||
private readonly ICurrentTenant _currentTenant; |
|||
private readonly IEnterpriseRepository _enterpriseRepository; |
|||
|
|||
public PortalGrantValidator( |
|||
ILogger<PortalGrantValidator> logger, |
|||
IOptions<IdentityServerOptions> options, |
|||
IEventService events, |
|||
IResourceOwnerPasswordValidator resourceOwnerValidator, |
|||
IdentitySecurityLogManager identitySecurityLogManager, |
|||
UserManager<IdentityUser> userManager, |
|||
ICurrentTenant currentTenant, |
|||
IEnterpriseRepository enterpriseRepository) |
|||
{ |
|||
_logger = logger; |
|||
_options = options.Value; |
|||
_events = events; |
|||
_resourceOwnerValidator = resourceOwnerValidator; |
|||
_identitySecurityLogManager = identitySecurityLogManager; |
|||
_userManager = userManager; |
|||
_currentTenant = currentTenant; |
|||
_enterpriseRepository = enterpriseRepository; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public async virtual Task ValidateAsync(ExtensionGrantValidationContext context) |
|||
{ |
|||
/* ************************************ |
|||
* |
|||
* 启用平台登录后,需要管理员在宿主端定义企业信息, 并关联到某个租户 |
|||
* |
|||
* 1、用户使用protal发起登录请求 |
|||
* 2、检查是否携带企业标识字段 EnterpriseId |
|||
* 2.1、未携带 EnterpriseId 字段, 检索关联了租户信息的企业列表, 通过自定义标头反馈给用户端 |
|||
* 2.2、检索关联 EnterpriseId 的租户信息, 切换指定租户, 通过 password 方式来进行登录验证 |
|||
* 3、登录成功返回token |
|||
* |
|||
* *************************************/ |
|||
|
|||
var parameters = context.Request.Raw; |
|||
|
|||
Guid? tenantId = null; |
|||
using (_currentTenant.Change(null)) |
|||
{ |
|||
var enterprise = parameters.Get("EnterpriseId"); |
|||
if (enterprise.IsNullOrWhiteSpace() || !Guid.TryParse(enterprise, out var enterpriseId)) |
|||
{ |
|||
// TODO: configurabled
|
|||
var enterprises = await _enterpriseRepository.GetEnterprisesInTenantListAsync(25); |
|||
|
|||
context.Result = new GrantValidationResult( |
|||
TokenRequestErrors.InvalidGrant, |
|||
customResponse: new Dictionary<string, object> |
|||
{ |
|||
// 是否可直接选择的模式
|
|||
{ "Enterprises", JsonConvert.SerializeObject(enterprises.Select(x => new { Id = x.Id, Name = x.Name, Logo = x.Logo })) }, |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
tenantId = await _enterpriseRepository.GetEnterpriseInTenantAsync(enterpriseId); |
|||
} |
|||
|
|||
using (_currentTenant.Change(tenantId)) |
|||
{ |
|||
var validatedRequest = new ValidatedTokenRequest |
|||
{ |
|||
Raw = parameters ?? throw new ArgumentNullException(nameof(parameters)), |
|||
Options = _options |
|||
}; |
|||
|
|||
var userName = parameters.Get(OidcConstants.TokenRequest.UserName); |
|||
var password = parameters.Get(OidcConstants.TokenRequest.Password); |
|||
|
|||
if (userName.IsNullOrWhiteSpace()) |
|||
{ |
|||
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); |
|||
return; |
|||
} |
|||
|
|||
if (password.IsNullOrWhiteSpace()) |
|||
{ |
|||
password = ""; |
|||
} |
|||
|
|||
if (userName.Length > _options.InputLengthRestrictions.UserName || |
|||
password.Length > _options.InputLengthRestrictions.Password) |
|||
{ |
|||
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); |
|||
return; |
|||
} |
|||
|
|||
var resourceOwnerContext = new ResourceOwnerPasswordValidationContext |
|||
{ |
|||
UserName = userName, |
|||
Password = password, |
|||
Request = validatedRequest |
|||
}; |
|||
await _resourceOwnerValidator.ValidateAsync(resourceOwnerContext); |
|||
|
|||
if (resourceOwnerContext.Result.IsError) |
|||
{ |
|||
// protect against bad validator implementations
|
|||
resourceOwnerContext.Result.Error ??= OidcConstants.TokenErrors.InvalidGrant; |
|||
|
|||
if (resourceOwnerContext.Result.Error == OidcConstants.TokenErrors.UnsupportedGrantType) |
|||
{ |
|||
_logger.LogError("Resource owner password credential grant type not supported"); |
|||
|
|||
await RaiseFailedResourceOwnerAuthenticationEventAsync(userName, "password grant type not supported", resourceOwnerContext.Request.Client.ClientId); |
|||
|
|||
context.Result = new GrantValidationResult(TokenRequestErrors.UnsupportedGrantType, customResponse: resourceOwnerContext.Result.CustomResponse); |
|||
return; |
|||
} |
|||
|
|||
var errorDescription = "invalid_username_or_password"; |
|||
|
|||
if (!resourceOwnerContext.Result.ErrorDescription.IsNullOrWhiteSpace()) |
|||
{ |
|||
errorDescription = resourceOwnerContext.Result.ErrorDescription; |
|||
} |
|||
|
|||
_logger.LogInformation("User authentication failed: ", errorDescription ?? resourceOwnerContext.Result.Error); |
|||
await RaiseFailedResourceOwnerAuthenticationEventAsync(userName, errorDescription, context.Request.Client.ClientId); |
|||
|
|||
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, errorDescription, resourceOwnerContext.Result.CustomResponse); |
|||
|
|||
return; |
|||
} |
|||
|
|||
if (resourceOwnerContext.Result.Subject == null) |
|||
{ |
|||
var error = "User authentication failed: no principal returned"; |
|||
_logger.LogError(error); |
|||
|
|||
await RaiseFailedResourceOwnerAuthenticationEventAsync(userName, error, context.Request.Client.ClientId); |
|||
|
|||
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); |
|||
|
|||
return; |
|||
} |
|||
|
|||
var currentUser = await _userManager.GetUserAsync(resourceOwnerContext.Result.Subject); |
|||
|
|||
await _events.RaiseAsync(new UserLoginSuccessEvent(userName, currentUser.Id.ToString(), currentUser.Name)); |
|||
|
|||
await SetSuccessResultAsync(context, currentUser); |
|||
} |
|||
} |
|||
|
|||
protected async virtual Task SetSuccessResultAsync(ExtensionGrantValidationContext context, IdentityUser user) |
|||
{ |
|||
var sub = await _userManager.GetUserIdAsync(user); |
|||
|
|||
_logger.LogInformation("Credentials validated for username: {username}", user.UserName); |
|||
|
|||
var additionalClaims = new List<Claim>(); |
|||
|
|||
await AddCustomClaimsAsync(additionalClaims, user, context); |
|||
|
|||
context.Result = new GrantValidationResult( |
|||
sub, |
|||
AuthenticationMethods.ConfirmationBySms, |
|||
additionalClaims.ToArray() |
|||
); |
|||
|
|||
await SaveSecurityLogAsync( |
|||
context, |
|||
user, |
|||
IdentityServerSecurityLogActionConsts.LoginSucceeded); |
|||
} |
|||
|
|||
protected async virtual Task SaveSecurityLogAsync( |
|||
ExtensionGrantValidationContext context, |
|||
IdentityUser user, |
|||
string action) |
|||
{ |
|||
var logContext = new IdentitySecurityLogContext |
|||
{ |
|||
Identity = IdentityServerSecurityLogIdentityConsts.IdentityServer, |
|||
Action = action, |
|||
UserName = user.UserName, |
|||
ClientId = await FindClientIdAsync(context) |
|||
}; |
|||
logContext.WithProperty("GrantType", GrantType); |
|||
|
|||
await _identitySecurityLogManager.SaveAsync(logContext); |
|||
} |
|||
|
|||
protected virtual Task<string> FindClientIdAsync(ExtensionGrantValidationContext context) |
|||
{ |
|||
return Task.FromResult(context.Request?.Client?.ClientId); |
|||
} |
|||
|
|||
protected virtual Task AddCustomClaimsAsync( |
|||
List<Claim> customClaims, |
|||
IdentityUser user, |
|||
ExtensionGrantValidationContext context) |
|||
{ |
|||
if (user.TenantId.HasValue) |
|||
{ |
|||
customClaims.Add( |
|||
new Claim( |
|||
AbpClaimTypes.TenantId, |
|||
user.TenantId?.ToString() |
|||
) |
|||
); |
|||
} |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
private Task RaiseFailedResourceOwnerAuthenticationEventAsync(string userName, string error, string clientId) |
|||
{ |
|||
return _events.RaiseAsync(new UserLoginFailureEvent(userName, error, interactive: false, clientId: clientId)); |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,19 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
<Import Project="..\..\..\configureawait.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.OpenIddict.AspNetCore" Version="$(VoloAbpPackageVersion)" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\platform\LINGYUN.Platform.Domain\LINGYUN.Platform.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,31 @@ |
|||
using LINGYUN.Platform; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.OpenIddict; |
|||
using Volo.Abp.OpenIddict.ExtensionGrantTypes; |
|||
|
|||
namespace LINGYUN.Abp.OpenIddict.Portal; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpOpenIddictAspNetCoreModule), |
|||
typeof(PlatformDomainModule))] |
|||
public class AbpOpenIddictPortalModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<OpenIddictServerBuilder>(builder => |
|||
{ |
|||
builder.AllowPortalFlow(); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpOpenIddictExtensionGrantsOptions>(options => |
|||
{ |
|||
options.Grants.TryAdd( |
|||
PortalTokenExtensionGrantConsts.GrantType, |
|||
new PortalTokenExtensionGrant()); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,328 @@ |
|||
using LINGYUN.Platform.Portal; |
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Logging; |
|||
using Microsoft.Extensions.Logging.Abstractions; |
|||
using Microsoft.Extensions.Options; |
|||
using Newtonsoft.Json; |
|||
using OpenIddict.Abstractions; |
|||
using OpenIddict.Server.AspNetCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.Immutable; |
|||
using System.Linq; |
|||
using System.Security.Claims; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.AspNetCore.MultiTenancy; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.OpenIddict; |
|||
using Volo.Abp.OpenIddict.ExtensionGrantTypes; |
|||
using Volo.Abp.Uow; |
|||
using Volo.Abp.Validation; |
|||
using IdentityUser = Volo.Abp.Identity.IdentityUser; |
|||
using SignInResult = Microsoft.AspNetCore.Identity.SignInResult; |
|||
|
|||
namespace LINGYUN.Abp.OpenIddict.Portal; |
|||
public class PortalTokenExtensionGrant : ITokenExtensionGrant |
|||
{ |
|||
public string Name => PortalTokenExtensionGrantConsts.GrantType; |
|||
|
|||
protected IAbpLazyServiceProvider LazyServiceProvider { get; set; } |
|||
protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService<ICurrentTenant>(); |
|||
protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService<IUnitOfWorkManager>(); |
|||
protected IEnterpriseRepository EnterpriseRepository => LazyServiceProvider.LazyGetRequiredService<IEnterpriseRepository>(); |
|||
protected SignInManager<IdentityUser> SignInManager => LazyServiceProvider.LazyGetRequiredService<SignInManager<IdentityUser>>(); |
|||
protected IdentityUserManager UserManager => LazyServiceProvider.LazyGetRequiredService<IdentityUserManager>(); |
|||
protected IOpenIddictScopeManager ScopeManager => LazyServiceProvider.LazyGetRequiredService<IOpenIddictScopeManager>(); |
|||
protected AbpOpenIddictClaimDestinationsManager OpenIddictClaimDestinationsManager => LazyServiceProvider.LazyGetRequiredService<AbpOpenIddictClaimDestinationsManager>(); |
|||
protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService<ILoggerFactory>(); |
|||
protected ILogger Logger => LazyServiceProvider.LazyGetService<ILogger>(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); |
|||
protected IServiceScopeFactory ServiceScopeFactory => LazyServiceProvider.LazyGetRequiredService<IServiceScopeFactory>(); |
|||
protected IOptions<AbpIdentityOptions> AbpIdentityOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpIdentityOptions>>(); |
|||
protected IOptions<IdentityOptions> IdentityOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<IdentityOptions>>(); |
|||
protected IOptions<AbpAspNetCoreMultiTenancyOptions> MultiTenancyOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpAspNetCoreMultiTenancyOptions>>(); |
|||
protected IdentitySecurityLogManager IdentitySecurityLogManager => LazyServiceProvider.LazyGetRequiredService<IdentitySecurityLogManager>(); |
|||
|
|||
public async virtual Task<IActionResult> HandleAsync(ExtensionGrantContext context) |
|||
{ |
|||
LazyServiceProvider = context.HttpContext.RequestServices.GetRequiredService<IAbpLazyServiceProvider>(); |
|||
|
|||
using var scope = ServiceScopeFactory.CreateScope(); |
|||
using var unitOfWork = UnitOfWorkManager.Begin(); |
|||
var enterprise = context.Request.GetParameter("EnterpriseId")?.ToString(); |
|||
|
|||
Guid? tenantId = null; |
|||
using (CurrentTenant.Change(null)) |
|||
{ |
|||
if (enterprise.IsNullOrWhiteSpace() || !Guid.TryParse(enterprise, out var enterpriseId)) |
|||
{ |
|||
// TODO: configurabled
|
|||
var enterprises = await EnterpriseRepository.GetEnterprisesInTenantListAsync(25); |
|||
|
|||
var properties = new AuthenticationProperties( |
|||
new Dictionary<string, string> |
|||
{ |
|||
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant, |
|||
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "invalid_enterprise" |
|||
}, |
|||
new Dictionary<string, object> |
|||
{ |
|||
// 是否可直接选择的模式
|
|||
{ "Enterprises", JsonConvert.SerializeObject(enterprises.Select(x => new { Id = x.Id, Name = x.Name, Logo = x.Logo })) }, |
|||
} |
|||
); |
|||
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
|
|||
tenantId = await EnterpriseRepository.GetEnterpriseInTenantAsync(enterpriseId); |
|||
} |
|||
|
|||
using (CurrentTenant.Change(tenantId)) |
|||
{ |
|||
return await HandlePasswordAsync(context); |
|||
} |
|||
} |
|||
|
|||
protected virtual async Task<IActionResult> HandlePasswordAsync(ExtensionGrantContext context) |
|||
{ |
|||
await ReplaceEmailToUsernameOfInputIfNeeds(context.Request); |
|||
|
|||
IdentityUser user = null; |
|||
|
|||
if (AbpIdentityOptions.Value.ExternalLoginProviders.Any()) |
|||
{ |
|||
foreach (var externalLoginProviderInfo in AbpIdentityOptions.Value.ExternalLoginProviders.Values) |
|||
{ |
|||
var externalLoginProvider = (IExternalLoginProvider)context.HttpContext.RequestServices |
|||
.GetRequiredService(externalLoginProviderInfo.Type); |
|||
|
|||
if (await externalLoginProvider.TryAuthenticateAsync(context.Request.Username, context.Request.Password)) |
|||
{ |
|||
user = await UserManager.FindByNameAsync(context.Request.Username); |
|||
if (user == null) |
|||
{ |
|||
user = await externalLoginProvider.CreateUserAsync(context.Request.Username, externalLoginProviderInfo.Name); |
|||
} |
|||
else |
|||
{ |
|||
await externalLoginProvider.UpdateUserAsync(user, externalLoginProviderInfo.Name); |
|||
} |
|||
|
|||
return await SetSuccessResultAsync(context, user); |
|||
} |
|||
} |
|||
} |
|||
|
|||
await IdentityOptions.SetAsync(); |
|||
|
|||
user = await UserManager.FindByNameAsync(context.Request.Username); |
|||
if (user == null) |
|||
{ |
|||
Logger.LogInformation("No user found matching username: {username}", context.Request.Username); |
|||
|
|||
var properties = new AuthenticationProperties(new Dictionary<string, string> |
|||
{ |
|||
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant, |
|||
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "Invalid username or password!" |
|||
}); |
|||
|
|||
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() |
|||
{ |
|||
Identity = OpenIddictSecurityLogIdentityConsts.OpenIddict, |
|||
Action = OpenIddictSecurityLogActionConsts.LoginInvalidUserName, |
|||
UserName = context.Request.Username, |
|||
ClientId = context.Request.ClientId |
|||
}); |
|||
|
|||
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
|
|||
var result = await SignInManager.CheckPasswordSignInAsync(user, context.Request.Password, true); |
|||
if (!result.Succeeded) |
|||
{ |
|||
string errorDescription; |
|||
if (result.IsLockedOut) |
|||
{ |
|||
Logger.LogInformation("Authentication failed for username: {username}, reason: locked out", context.Request.Username); |
|||
errorDescription = "The user account has been locked out due to invalid login attempts. Please wait a while and try again."; |
|||
} |
|||
else if (result.IsNotAllowed) |
|||
{ |
|||
Logger.LogInformation("Authentication failed for username: {username}, reason: not allowed", context.Request.Username); |
|||
errorDescription = "You are not allowed to login! Your account is inactive or needs to confirm your email/phone number."; |
|||
} |
|||
else |
|||
{ |
|||
Logger.LogInformation("Authentication failed for username: {username}, reason: invalid credentials", context.Request.Username); |
|||
errorDescription = "Invalid username or password!"; |
|||
} |
|||
|
|||
var properties = new AuthenticationProperties(new Dictionary<string, string> |
|||
{ |
|||
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant, |
|||
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = errorDescription |
|||
}); |
|||
|
|||
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
|
|||
if (await IsTfaEnabledAsync(user)) |
|||
{ |
|||
return await HandleTwoFactorLoginAsync(context, user); |
|||
} |
|||
|
|||
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext |
|||
{ |
|||
Identity = OpenIddictSecurityLogIdentityConsts.OpenIddict, |
|||
Action = result.ToIdentitySecurityLogAction(), |
|||
UserName = context.Request.Username, |
|||
ClientId = context.Request.ClientId |
|||
}); |
|||
|
|||
return await SetSuccessResultAsync(context, user); |
|||
} |
|||
|
|||
protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(OpenIddictRequest request) |
|||
{ |
|||
if (!ValidationHelper.IsValidEmailAddress(request.Username)) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
var userByUsername = await UserManager.FindByNameAsync(request.Username); |
|||
if (userByUsername != null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
var userByEmail = await UserManager.FindByEmailAsync(request.Username); |
|||
if (userByEmail == null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
request.Username = userByEmail.UserName; |
|||
} |
|||
|
|||
protected virtual async Task<IActionResult> HandleTwoFactorLoginAsync(ExtensionGrantContext context, IdentityUser user) |
|||
{ |
|||
var twoFactorProvider = context.Request.GetParameter("TwoFactorProvider")?.ToString(); |
|||
var twoFactorCode = context.Request.GetParameter("TwoFactorCode")?.ToString(); ; |
|||
if (!twoFactorProvider.IsNullOrWhiteSpace() && !twoFactorCode.IsNullOrWhiteSpace()) |
|||
{ |
|||
var providers = await UserManager.GetValidTwoFactorProvidersAsync(user); |
|||
if (providers.Contains(twoFactorProvider) && await UserManager.VerifyTwoFactorTokenAsync(user, twoFactorProvider, twoFactorCode)) |
|||
{ |
|||
return await SetSuccessResultAsync(context, user); |
|||
} |
|||
|
|||
Logger.LogInformation("Authentication failed for username: {username}, reason: InvalidAuthenticatorCode", context.Request.Username); |
|||
|
|||
var properties = new AuthenticationProperties(new Dictionary<string, string> |
|||
{ |
|||
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant, |
|||
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "Invalid authenticator code!" |
|||
}); |
|||
|
|||
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
else |
|||
{ |
|||
Logger.LogInformation("Authentication failed for username: {username}, reason: RequiresTwoFactor", context.Request.Username); |
|||
var twoFactorToken = await UserManager.GenerateUserTokenAsync(user, TokenOptions.DefaultProvider, nameof(SignInResult.RequiresTwoFactor)); |
|||
|
|||
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext |
|||
{ |
|||
Identity = OpenIddictSecurityLogIdentityConsts.OpenIddict, |
|||
Action = OpenIddictSecurityLogActionConsts.LoginRequiresTwoFactor, |
|||
UserName = context.Request.Username, |
|||
ClientId = context.Request.ClientId |
|||
}); |
|||
|
|||
var properties = new AuthenticationProperties( |
|||
items: new Dictionary<string, string> |
|||
{ |
|||
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.InvalidGrant, |
|||
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = |
|||
nameof(SignInResult.RequiresTwoFactor), |
|||
}, |
|||
parameters: new Dictionary<string, object> |
|||
{ |
|||
["userId"] = user.Id.ToString("N"), |
|||
["twoFactorToken"] = twoFactorToken |
|||
}); |
|||
|
|||
return Forbid(properties, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); |
|||
} |
|||
} |
|||
|
|||
protected virtual async Task<IActionResult> SetSuccessResultAsync(ExtensionGrantContext context, IdentityUser user) |
|||
{ |
|||
// Create a new ClaimsPrincipal containing the claims that
|
|||
// will be used to create an id_token, a token or a code.
|
|||
var principal = await SignInManager.CreateUserPrincipalAsync(user); |
|||
|
|||
principal.SetScopes(context.Request.GetScopes()); |
|||
principal.SetResources(await GetResourcesAsync(context.Request.GetScopes())); |
|||
|
|||
await SetClaimsDestinationsAsync(principal); |
|||
|
|||
await IdentitySecurityLogManager.SaveAsync( |
|||
new IdentitySecurityLogContext |
|||
{ |
|||
Identity = OpenIddictSecurityLogIdentityConsts.OpenIddict, |
|||
Action = OpenIddictSecurityLogActionConsts.LoginSucceeded, |
|||
UserName = context.Request.Username, |
|||
ClientId = context.Request.ClientId |
|||
} |
|||
); |
|||
|
|||
if (user.TenantId.HasValue) |
|||
{ |
|||
AbpMultiTenancyCookieHelper.SetTenantCookie( |
|||
context.HttpContext, |
|||
user.TenantId, |
|||
MultiTenancyOptions.Value.TenantKey); |
|||
} |
|||
|
|||
return new Microsoft.AspNetCore.Mvc.SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, principal); |
|||
} |
|||
|
|||
protected virtual async Task<bool> IsTfaEnabledAsync(IdentityUser user) |
|||
{ |
|||
return UserManager.SupportsUserTwoFactor && |
|||
await UserManager.GetTwoFactorEnabledAsync(user) && |
|||
(await UserManager.GetValidTwoFactorProvidersAsync(user)).Count > 0; |
|||
} |
|||
|
|||
protected virtual async Task<IEnumerable<string>> GetResourcesAsync(ImmutableArray<string> scopes) |
|||
{ |
|||
var resources = new List<string>(); |
|||
if (!scopes.Any()) |
|||
{ |
|||
return resources; |
|||
} |
|||
|
|||
await foreach (var resource in ScopeManager.ListResourcesAsync(scopes)) |
|||
{ |
|||
resources.Add(resource); |
|||
} |
|||
return resources; |
|||
} |
|||
|
|||
protected virtual async Task SetClaimsDestinationsAsync(ClaimsPrincipal principal) |
|||
{ |
|||
await OpenIddictClaimDestinationsManager.SetAsync(principal); |
|||
} |
|||
|
|||
public virtual ForbidResult Forbid(AuthenticationProperties properties, params string[] authenticationSchemes) |
|||
{ |
|||
return new ForbidResult( |
|||
authenticationSchemes, |
|||
properties); |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
namespace LINGYUN.Abp.OpenIddict.Portal; |
|||
public static class PortalTokenExtensionGrantConsts |
|||
{ |
|||
public const string GrantType = "portal"; |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using LINGYUN.Abp.OpenIddict.Portal; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection; |
|||
|
|||
public static class PortalOpenIddictServerBuilderExtensions |
|||
{ |
|||
public static OpenIddictServerBuilder AllowPortalFlow(this OpenIddictServerBuilder builder) |
|||
{ |
|||
return builder.AllowCustomFlow(PortalTokenExtensionGrantConsts.GrantType); |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
namespace LINGYUN.Platform.Portal; |
|||
public static class EnterpriseConsts |
|||
{ |
|||
public static int MaxNameLength { get; set; } = 255; |
|||
public static int MaxEnglishNameLength { get; set; } = 512; |
|||
public static int MaxLogoLength { get; set; } = 512; |
|||
public static int MaxAddressLength { get; set; } = 255; |
|||
public static int MaxLegalManLength { get; set; } = 60; |
|||
public static int MaxTaxCodeLength { get; set; } = 40; |
|||
public static int MaxOrganizationCodeLength { get; set; } = 16; |
|||
public static int MaxRegistrationCodeLength { get; set; } = 30; |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
using System; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
|
|||
namespace LINGYUN.Platform.Portal; |
|||
/// <summary>
|
|||
/// 企业信息
|
|||
/// </summary>
|
|||
public class Enterprise : FullAuditedAggregateRoot<Guid> |
|||
{ |
|||
/// <summary>
|
|||
/// 租户标识
|
|||
/// </summary>
|
|||
public virtual Guid? TenantId { get; protected set; } |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public virtual string Name { get; protected set; } |
|||
/// <summary>
|
|||
/// 英文名称
|
|||
/// </summary>
|
|||
public virtual string EnglishName { get; set; } |
|||
/// <summary>
|
|||
/// Logo
|
|||
/// </summary>
|
|||
public virtual string Logo { get; set; } |
|||
/// <summary>
|
|||
/// 地址
|
|||
/// </summary>
|
|||
public virtual string Address { get; set; } |
|||
/// <summary>
|
|||
/// 法人代表
|
|||
/// </summary>
|
|||
public virtual string LegalMan { get; set; } |
|||
/// <summary>
|
|||
/// 税务登记号
|
|||
/// </summary>
|
|||
public virtual string TaxCode { get; set; } |
|||
/// <summary>
|
|||
/// 组织机构代码
|
|||
/// </summary>
|
|||
public virtual string OrganizationCode { get; protected set; } |
|||
/// <summary>
|
|||
/// 注册代码
|
|||
/// </summary>
|
|||
public virtual string RegistrationCode { get; protected set; } |
|||
/// <summary>
|
|||
/// 注册日期
|
|||
/// </summary>
|
|||
public virtual DateTime? RegistrationDate { get; protected set; } |
|||
/// <summary>
|
|||
/// 过期日期
|
|||
/// </summary>
|
|||
public virtual DateTime? ExpirationDate { get; protected set; } |
|||
protected Enterprise() |
|||
{ |
|||
ExtraProperties = new ExtraPropertyDictionary(); |
|||
this.SetDefaultsForExtraProperties(); |
|||
} |
|||
|
|||
public Enterprise( |
|||
string name, |
|||
string address, |
|||
string taxCode, |
|||
string organizationCode = null, |
|||
string registrationCode = null, |
|||
DateTime? registrationDate = null, |
|||
DateTime? expirationDate = null, |
|||
Guid? tenantId = null) |
|||
{ |
|||
Address = Check.Length(address, nameof(address), EnterpriseConsts.MaxAddressLength); |
|||
TaxCode = Check.Length(taxCode, nameof(taxCode), EnterpriseConsts.MaxTaxCodeLength); |
|||
TenantId = tenantId; |
|||
|
|||
SetName(name); |
|||
SetOrganization(organizationCode); |
|||
SetRegistration(registrationCode, registrationDate, expirationDate); |
|||
|
|||
ExtraProperties = new ExtraPropertyDictionary(); |
|||
this.SetDefaultsForExtraProperties(); |
|||
} |
|||
|
|||
public void SetTenantId(Guid? tenantId = null) |
|||
{ |
|||
TenantId = tenantId; |
|||
} |
|||
|
|||
public void SetName(string name, string englishName = null) |
|||
{ |
|||
Name = Check.NotNullOrWhiteSpace(name, nameof(name), EnterpriseConsts.MaxNameLength); |
|||
EnglishName = Check.Length(englishName, nameof(englishName), EnterpriseConsts.MaxEnglishNameLength); |
|||
} |
|||
|
|||
public void SetOrganization(string organizationCode) |
|||
{ |
|||
OrganizationCode = Check.Length(organizationCode, nameof(organizationCode), EnterpriseConsts.MaxOrganizationCodeLength); |
|||
} |
|||
|
|||
public void SetRegistration( |
|||
string registrationCode, |
|||
DateTime? registrationDate = null, |
|||
DateTime? expirationDate = null) |
|||
{ |
|||
RegistrationCode = Check.Length(registrationCode, nameof(registrationCode), EnterpriseConsts.MaxRegistrationCodeLength); |
|||
RegistrationDate = registrationDate; |
|||
ExpirationDate = expirationDate; |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace LINGYUN.Platform.Portal; |
|||
public interface IEnterpriseRepository : IBasicRepository<Enterprise, Guid> |
|||
{ |
|||
Task<List<Enterprise>> GetEnterprisesInTenantListAsync( |
|||
int maxResultCount = 10, |
|||
CancellationToken cancellationToken = default); |
|||
|
|||
Task<Guid?> GetEnterpriseInTenantAsync( |
|||
Guid id, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
@ -1,24 +1,26 @@ |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Packages; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName(PlatformDbProperties.ConnectionStringName)] |
|||
public interface IPlatformDbContext : IEfCoreDbContext |
|||
{ |
|||
DbSet<Menu> Menus { get; } |
|||
DbSet<Layout> Layouts { get; } |
|||
DbSet<RoleMenu> RoleMenus { get; } |
|||
using LINGYUN.Platform.Portal; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName(PlatformDbProperties.ConnectionStringName)] |
|||
public interface IPlatformDbContext : IEfCoreDbContext |
|||
{ |
|||
DbSet<Menu> Menus { get; } |
|||
DbSet<Layout> Layouts { get; } |
|||
DbSet<RoleMenu> RoleMenus { get; } |
|||
DbSet<UserMenu> UserMenus { get; } |
|||
DbSet<UserFavoriteMenu> UserFavoriteMenus { get; } |
|||
DbSet<Data> Datas { get; } |
|||
DbSet<DataItem> DataItems { get; } |
|||
DbSet<Package> Packages { get; } |
|||
DbSet<PackageBlob> PackageBlobs { get; } |
|||
} |
|||
} |
|||
DbSet<UserFavoriteMenu> UserFavoriteMenus { get; } |
|||
DbSet<Data> Datas { get; } |
|||
DbSet<DataItem> DataItems { get; } |
|||
DbSet<Package> Packages { get; } |
|||
DbSet<PackageBlob> PackageBlobs { get; } |
|||
DbSet<Enterprise> Enterprises { get; } |
|||
} |
|||
} |
|||
|
|||
@ -1,36 +1,38 @@ |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Packages; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName(PlatformDbProperties.ConnectionStringName)] |
|||
public class PlatformDbContext : AbpDbContext<PlatformDbContext>, IPlatformDbContext |
|||
{ |
|||
using LINGYUN.Platform.Portal; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName(PlatformDbProperties.ConnectionStringName)] |
|||
public class PlatformDbContext : AbpDbContext<PlatformDbContext>, IPlatformDbContext |
|||
{ |
|||
public DbSet<RoleMenu> RoleMenus { get; set; } |
|||
public DbSet<UserMenu> UserMenus { get; set; } |
|||
public DbSet<UserFavoriteMenu> UserFavoriteMenus { get; set; } |
|||
public DbSet<Menu> Menus { get; set; } |
|||
public DbSet<Layout> Layouts { get; set; } |
|||
public DbSet<UserFavoriteMenu> UserFavoriteMenus { get; set; } |
|||
public DbSet<Menu> Menus { get; set; } |
|||
public DbSet<Layout> Layouts { get; set; } |
|||
public DbSet<Data> Datas { get; set; } |
|||
public DbSet<DataItem> DataItems { get; set; } |
|||
public DbSet<DataItem> DataItems { get; set; } |
|||
public DbSet<Package> Packages { get; set; } |
|||
public DbSet<PackageBlob> PackageBlobs { get; set; } |
|||
public PlatformDbContext(DbContextOptions<PlatformDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
builder.ConfigurePlatform(); |
|||
} |
|||
} |
|||
} |
|||
public DbSet<PackageBlob> PackageBlobs { get; set; } |
|||
public DbSet<Enterprise> Enterprises { get; set; } |
|||
public PlatformDbContext(DbContextOptions<PlatformDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
builder.ConfigurePlatform(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,57 +1,57 @@ |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Packages; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System.Linq; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
public static class PlatformEfCoreQueryableExtensions |
|||
{ |
|||
|
|||
public static IQueryable<Layout> IncludeDetails(this IQueryable<Layout> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable; |
|||
} |
|||
|
|||
public static IQueryable<Menu> IncludeDetails(this IQueryable<Menu> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable; |
|||
} |
|||
|
|||
public static IQueryable<Data> IncludeDetails(this IQueryable<Data> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable |
|||
.AsSplitQuery() |
|||
.Include(x => x.Items); |
|||
} |
|||
|
|||
public static IQueryable<Package> IncludeDetails(this IQueryable<Package> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable |
|||
.AsSplitQuery() |
|||
.Include(x => x.Blobs); |
|||
} |
|||
} |
|||
} |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System.Linq; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
public static class PlatformEfCoreQueryableExtensions |
|||
{ |
|||
|
|||
public static IQueryable<Layout> IncludeDetails(this IQueryable<Layout> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable; |
|||
} |
|||
|
|||
public static IQueryable<Menu> IncludeDetails(this IQueryable<Menu> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable; |
|||
} |
|||
|
|||
public static IQueryable<Data> IncludeDetails(this IQueryable<Data> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable |
|||
.AsSplitQuery() |
|||
.Include(x => x.Items); |
|||
} |
|||
|
|||
public static IQueryable<Package> IncludeDetails(this IQueryable<Package> queryable, bool include = true) |
|||
{ |
|||
if (!include) |
|||
{ |
|||
return queryable; |
|||
} |
|||
|
|||
return queryable |
|||
.AsSplitQuery() |
|||
.Include(x => x.Blobs); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,32 +1,34 @@ |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Datas; |
|||
using LINGYUN.Platform.Layouts; |
|||
using LINGYUN.Platform.Menus; |
|||
using LINGYUN.Platform.Packages; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(PlatformDomainModule), |
|||
typeof(AbpEntityFrameworkCoreModule))] |
|||
public class PlatformEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<PlatformDbContext>(options => |
|||
{ |
|||
options.AddRepository<Data, EfCoreDataRepository>(); |
|||
options.AddRepository<Menu, EfCoreMenuRepository>(); |
|||
options.AddRepository<UserMenu, EfCoreUserMenuRepository>(); |
|||
using LINGYUN.Platform.Portal; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Platform.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(PlatformDomainModule), |
|||
typeof(AbpEntityFrameworkCoreModule))] |
|||
public class PlatformEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<PlatformDbContext>(options => |
|||
{ |
|||
options.AddRepository<Data, EfCoreDataRepository>(); |
|||
options.AddRepository<Menu, EfCoreMenuRepository>(); |
|||
options.AddRepository<UserMenu, EfCoreUserMenuRepository>(); |
|||
options.AddRepository<RoleMenu, EfCoreRoleMenuRepository>(); |
|||
options.AddRepository<UserFavoriteMenu, EfCoreUserFavoriteMenuRepository>(); |
|||
options.AddRepository<Layout, EfCoreLayoutRepository>(); |
|||
options.AddRepository<Package, EfCorePackageRepository>(); |
|||
|
|||
options.AddDefaultRepositories(includeAllEntities: true); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
options.AddRepository<UserFavoriteMenu, EfCoreUserFavoriteMenuRepository>(); |
|||
options.AddRepository<Layout, EfCoreLayoutRepository>(); |
|||
options.AddRepository<Package, EfCorePackageRepository>(); |
|||
options.AddRepository<Enterprise, EfCoreEnterpriseRepository>(); |
|||
|
|||
options.AddDefaultRepositories(includeAllEntities: true); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,40 @@ |
|||
using LINGYUN.Platform.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.Portal; |
|||
public class EfCoreEnterpriseRepository : EfCoreRepository<IPlatformDbContext, Enterprise, Guid>, IEnterpriseRepository |
|||
{ |
|||
public EfCoreEnterpriseRepository( |
|||
IDbContextProvider<IPlatformDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async virtual Task<Guid?> GetEnterpriseInTenantAsync( |
|||
Guid id, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
return await (await GetDbSetAsync()) |
|||
.Where(x => x.Id == id) |
|||
.Select(x => x.TenantId) |
|||
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); |
|||
} |
|||
|
|||
public async virtual Task<List<Enterprise>> GetEnterprisesInTenantListAsync( |
|||
int maxResultCount = 10, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
return await (await GetDbSetAsync()) |
|||
.Where(x => x.TenantId.HasValue) |
|||
.Take(maxResultCount) |
|||
.OrderByDescending(x => x.CreationTime) |
|||
.ToListAsync(GetCancellationToken(cancellationToken)); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue