34 changed files with 767 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<content Remove="LINGYUN\Abp\ProjectManagement\Localization\ApplicationContracts\*.json" /> |
|||
<EmbeddedResource Include="LINGYUN\Abp\ProjectManagement\Localization\ApplicationContracts\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Authorization" Version="4.2.1" /> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="4.2.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.ProjectManagement.Domain.Shared\LINGYUN.Abp.ProjectManagement.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,29 @@ |
|||
using LINGYUN.Abp.ProjectManagement.Localization; |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDddApplicationContractsModule), |
|||
typeof(AbpProjectManagementDomainSharedModule))] |
|||
public class AbpProjectManagementApplicationContractsModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpProjectManagementApplicationContractsModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<AbpProjectManagementResource>() |
|||
.AddVirtualJson("/LINGYUN/Abp/ProjectManagement/Localization/ApplicationContracts"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.2.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.ProjectManagement.Application.Contracts\LINGYUN.Abp.ProjectManagement.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDddApplicationModule), |
|||
typeof(AbpProjectManagementApplicationContractsModule))] |
|||
public class AbpProjectManagementApplicationModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<content Remove="LINGYUN\Abp\ProjectManagement\Localization\Domain\*.json" /> |
|||
<EmbeddedResource Include="LINGYUN\Abp\ProjectManagement\Localization\Domain\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Validation" Version="4.2.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,30 @@ |
|||
using LINGYUN.Abp.ProjectManagement.Localization; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Validation; |
|||
using Volo.Abp.Validation.Localization; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpValidationModule))] |
|||
public class AbpProjectManagementDomainSharedModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpProjectManagementDomainSharedModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<AbpProjectManagementResource>() |
|||
.AddBaseTypes(typeof(AbpValidationResource)) |
|||
.AddVirtualJson("/LINGYUN/Abp/ProjectManagement/Localization/Domain"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Localization |
|||
{ |
|||
[LocalizationResourceName("AbpProjectManagement")] |
|||
public class AbpProjectManagementResource |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public enum BuildStatus |
|||
{ |
|||
Created = 0, |
|||
Successed = 1, |
|||
Failed = 10 |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public enum RepositoryType |
|||
{ |
|||
Git = 0, |
|||
Subversion = 1 |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
namespace LINGYUN.Abp.ProjectManagement.Templates |
|||
{ |
|||
public enum OptionsType |
|||
{ |
|||
Empty = 0, |
|||
Input = 1, |
|||
Options = 2 |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AutoMapper" Version="4.2.1" /> |
|||
<PackageReference Include="Volo.Abp.Cli.Core" Version="4.2.1" /> |
|||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="4.2.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.ProjectManagement.Domain.Shared\LINGYUN.Abp.ProjectManagement.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.Cli; |
|||
using Volo.Abp.Domain; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDddDomainModule), |
|||
typeof(AbpCliCoreModule), |
|||
typeof(AbpProjectManagementDomainSharedModule))] |
|||
public class AbpProjectManagementDomainModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Packages |
|||
{ |
|||
public class Package |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using Microsoft.Extensions.Logging; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public interface IProjectLogRepository : IRepository<ProductBuildLog, int> |
|||
{ |
|||
Task<List<ProductBuildLog>> GetListAsync( |
|||
Guid projectId, |
|||
LogLevel? level = null); |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public interface IProjectRepository : IRepository<Project, Guid> |
|||
{ |
|||
Task<bool> CheckNameAsync( |
|||
string name, |
|||
CancellationToken cancellationToken = default); |
|||
Task<Project> FindByNameAsync( |
|||
string name, |
|||
CancellationToken cancellationToken = default); |
|||
|
|||
Task<ProjectTemplate> FindTemplateAsync( |
|||
Guid id, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public static class IProjectRepositoryExtensions |
|||
{ |
|||
public static async Task<ProjectTemplate> GetTemplateAsync( |
|||
this IProjectRepository repository, |
|||
Guid id, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var template = await repository.FindTemplateAsync(id, cancellationToken); |
|||
|
|||
return template ?? |
|||
throw new EntityNotFoundException(typeof(ProjectTemplate), id); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using Microsoft.Extensions.Logging; |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public class ProductBuildLog : Entity<int> |
|||
{ |
|||
public virtual Guid ProjectId { get; set; } |
|||
public virtual string Message { get; set; } |
|||
public virtual LogLevel Level { get; set; } |
|||
protected ProductBuildLog() { } |
|||
public ProductBuildLog( |
|||
Guid projectId, |
|||
string message, |
|||
LogLevel level = LogLevel.Information) |
|||
{ |
|||
ProjectId = projectId; |
|||
Message = message; |
|||
Level = level; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.Timing; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public class Project : AuditedAggregateRoot<Guid> |
|||
{ |
|||
public virtual string Name { get; protected set; } |
|||
public virtual string Version { get; protected set; } |
|||
public virtual BuildStatus Status { get; protected set; } |
|||
public virtual DateTime? BuildTime { get; protected set; } |
|||
public virtual string BuildError { get; protected set; } |
|||
public virtual string PackageIconUrl { get; protected set; } |
|||
public virtual string PackageProjectUrl { get; protected set; } |
|||
public virtual string PackageLicenseExpression { get; protected set; } |
|||
public virtual RepositoryType? RepositoryType { get; protected set; } |
|||
public virtual string RepositoryUrl { get; protected set; } |
|||
public virtual string Template { get; protected set; } |
|||
protected Project() { } |
|||
public Project( |
|||
Guid id, |
|||
string template, |
|||
string name, |
|||
string version = "1.0.0.0", |
|||
string packageIconUrl = "", |
|||
string packageProjectUrl = "", |
|||
string packageLicenseExpression = "MIT", |
|||
RepositoryType? repositoryType = null, |
|||
string repositoryUrl = "") |
|||
: base(id) |
|||
{ |
|||
Name = name; |
|||
Template = template; |
|||
Version = version; |
|||
PackageIconUrl = packageIconUrl; |
|||
PackageProjectUrl = packageProjectUrl; |
|||
PackageLicenseExpression = packageLicenseExpression; |
|||
RepositoryType = repositoryType; |
|||
RepositoryUrl = repositoryUrl; |
|||
|
|||
Status = BuildStatus.Created; |
|||
} |
|||
|
|||
public void BuildSuccess(IClock clock) |
|||
{ |
|||
BuildError = ""; |
|||
BuildTime = clock.Now; |
|||
Status = BuildStatus.Successed; |
|||
} |
|||
|
|||
public void BuildFailed(IClock clock, Exception ex) |
|||
{ |
|||
BuildTime = clock.Now; |
|||
Status = BuildStatus.Failed; |
|||
BuildError = GetBaseExceptionError(ex); |
|||
} |
|||
|
|||
private static string GetBaseExceptionError(Exception ex) |
|||
{ |
|||
if (ex == null) |
|||
{ |
|||
return ""; |
|||
} |
|||
return string.Concat(ex?.Message ?? "", GetBaseExceptionError(ex?.InnerException)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public class ProjectItem : AggregateRoot<Guid> |
|||
{ |
|||
public virtual string Path { get; protected set; } |
|||
public virtual string Name { get; protected set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,154 @@ |
|||
using ICSharpCode.SharpZipLib.Zip; |
|||
using LINGYUN.Abp.ProjectManagement.Templates; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Cli; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.IO; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public class ProjectManager : DomainService |
|||
{ |
|||
protected IProjectRepository ProjectRepository { get; } |
|||
protected ITemplateRepository TemplateRepository { get; } |
|||
|
|||
protected CliService Service => LazyServiceProvider.LazyGetRequiredService<CliService>(); |
|||
protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService<IUnitOfWorkManager>(); |
|||
|
|||
public ProjectManager( |
|||
IProjectRepository projectRepository, |
|||
ITemplateRepository templateRepository) |
|||
{ |
|||
ProjectRepository = projectRepository; |
|||
TemplateRepository = templateRepository; |
|||
} |
|||
|
|||
public virtual async Task<Project> CreateAsync(Project project) |
|||
{ |
|||
if (await ProjectRepository.CheckNameAsync(project.Name)) |
|||
{ |
|||
throw new BusinessException(""); |
|||
} |
|||
project = await ProjectRepository.InsertAsync(project); |
|||
|
|||
return project; |
|||
} |
|||
|
|||
public virtual async Task<Project> UpdateAsync(Project project) |
|||
{ |
|||
project = await ProjectRepository.UpdateAsync(project); |
|||
|
|||
return project; |
|||
} |
|||
|
|||
public virtual async Task DeleteAsync(Project project) |
|||
{ |
|||
await ProjectRepository.DeleteAsync(project); |
|||
} |
|||
|
|||
public virtual async Task<bool> BuildAsync(Project project) |
|||
{ |
|||
using var unitOfWork = UnitOfWorkManager.Begin(); |
|||
try |
|||
{ |
|||
var projectTemplate = await ProjectRepository.FindTemplateAsync(project.Id); |
|||
|
|||
var template = await TemplateRepository.GetAsync(projectTemplate.TemplateId); |
|||
|
|||
// 组成参数列表
|
|||
var projectBuildArgs = projectTemplate.Options |
|||
.Select(x => new { x.Key, x.Value }); |
|||
if (projectTemplate.ExtraProperties.Any()) |
|||
{ |
|||
projectBuildArgs = projectBuildArgs.Union( |
|||
projectTemplate.ExtraProperties |
|||
.Select(x => new { x.Key, Value = x.Value?.ToString() ?? "" })); |
|||
} |
|||
// 检查必须参数
|
|||
var ignoredArgs = template.GetMustOptions().Where(x => !projectBuildArgs.Any(y => x.Key.Equals(y.Key))); |
|||
if (ignoredArgs.Any()) |
|||
{ |
|||
project.BuildFailed(Clock, new Exception($"构建项目失败,缺失必要的参数: {ignoredArgs.Select(x => x.Key).JoinAsString(";")}")); |
|||
} |
|||
else |
|||
{ |
|||
// 取项目ID作为存储路径
|
|||
var path = Path.Combine( |
|||
Directory.GetCurrentDirectory(), |
|||
project.Id.ToString()); |
|||
var argsList = new List<string> |
|||
{ |
|||
"new", // new命令
|
|||
"--skip-cli-version-check", // 不检查cli版本
|
|||
project.Name, |
|||
"-o", // 输出目录
|
|||
path |
|||
}; |
|||
|
|||
foreach (var option in projectBuildArgs) |
|||
{ |
|||
argsList.Add(option.Key); |
|||
if (!option.Value.IsNullOrWhiteSpace()) |
|||
{ |
|||
var value = option.Value; |
|||
if (value.Contains(" ")) |
|||
{ |
|||
if (!value.StartsWith("\"")) |
|||
{ |
|||
value = "\"" + value; |
|||
} |
|||
if (!value.EndsWith("\"")) |
|||
{ |
|||
value += "\""; |
|||
} |
|||
} |
|||
argsList.Add(value); |
|||
} |
|||
} |
|||
|
|||
await Service.RunAsync(argsList.ToArray()); |
|||
project.BuildSuccess(Clock); |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
project.BuildFailed(Clock, ex); |
|||
} |
|||
|
|||
await ProjectRepository.UpdateAsync(project); |
|||
|
|||
await unitOfWork.CompleteAsync(); |
|||
|
|||
return project.Status == BuildStatus.Successed; |
|||
} |
|||
|
|||
public virtual async Task AddPackagesAsync() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public virtual async Task<byte[]> DownloadAsync(Project project) |
|||
{ |
|||
var projectDir = Path.Combine( |
|||
Directory.GetCurrentDirectory(), |
|||
project.Id.ToString()); |
|||
var projectZipFile = Path.Combine(projectDir, project.Name + ".zip"); |
|||
FileHelper.DeleteIfExists(projectZipFile); |
|||
|
|||
if (!Directory.Exists(projectDir)) |
|||
{ |
|||
throw new BusinessException(""); |
|||
} |
|||
var zip = new FastZip(); |
|||
zip.CreateZip(projectZipFile, projectDir, true, null); |
|||
|
|||
return await FileHelper.ReadAllBytesAsync(projectZipFile); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public class ProjectOptions : Entity<int> |
|||
{ |
|||
public virtual Guid ProjectId { get; protected set; } |
|||
public virtual string Key { get; protected set; } |
|||
public virtual string Value { get; protected set; } |
|||
protected ProjectOptions() { } |
|||
public ProjectOptions( |
|||
Guid projectId, |
|||
string key, |
|||
string value = "") |
|||
{ |
|||
ProjectId = projectId; |
|||
Key = key; |
|||
Value = value; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Projects |
|||
{ |
|||
public class ProjectTemplate : AggregateRoot<Guid> |
|||
{ |
|||
public virtual Guid ProjectId { get; protected set; } |
|||
public virtual Guid TemplateId { get; protected set; } |
|||
public virtual ICollection<ProjectOptions> Options { get; protected set; } |
|||
protected ProjectTemplate() { } |
|||
public ProjectTemplate( |
|||
Guid id, |
|||
Guid projectId, |
|||
Guid templateId) |
|||
: base(id) |
|||
{ |
|||
ProjectId = projectId; |
|||
TemplateId = templateId; |
|||
|
|||
Options = new Collection<ProjectOptions>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Templates |
|||
{ |
|||
public interface ITemplateRepository : IRepository<Template, Guid> |
|||
{ |
|||
Task<Template> FindByNameAsync( |
|||
string name, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Templates |
|||
{ |
|||
public static class ITemplateRepositoryExtensions |
|||
{ |
|||
public static async Task<Template> GetByNameAsync( |
|||
this ITemplateRepository repository, |
|||
string name, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var template = await repository.FindByNameAsync(name, cancellationToken); |
|||
|
|||
return template ?? |
|||
throw new EntityNotFoundException(typeof(Template), name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Templates |
|||
{ |
|||
public class Template : AggregateRoot<Guid> |
|||
{ |
|||
public virtual string Name { get; protected set; } |
|||
public virtual ICollection<TemplateOptions> Options { get; protected set; } |
|||
protected Template() { } |
|||
public Template( |
|||
Guid id, |
|||
string name) |
|||
: base(id) |
|||
{ |
|||
Name = name; |
|||
Options = new Collection<TemplateOptions>(); |
|||
} |
|||
|
|||
public IEnumerable<TemplateOptions> GetMustOptions() |
|||
{ |
|||
return Options.Where(x => !x.Optional); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.Templates |
|||
{ |
|||
public class TemplateOptions : AggregateRoot<Guid> |
|||
{ |
|||
public virtual bool Optional { get; protected set; } |
|||
public virtual string Key { get; protected set; } |
|||
public virtual string FullKey { get; protected set; } |
|||
public virtual OptionsType Type { get; protected set; } |
|||
public virtual string Description { get; protected set; } |
|||
protected TemplateOptions() { } |
|||
public TemplateOptions( |
|||
Guid id, |
|||
string key, |
|||
string fullKey, |
|||
bool optional = true, |
|||
OptionsType type = OptionsType.Empty, |
|||
string description = "") |
|||
: base(id) |
|||
{ |
|||
Key = key; |
|||
FullKey = fullKey; |
|||
Optional = optional; |
|||
Type = type; |
|||
Description = description; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.1</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="4.2.1" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpProjectManagementDomainModule), |
|||
typeof(AbpEntityFrameworkCoreModule))] |
|||
public class AbpProjectManagementEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="4.2.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.ProjectManagement.Application.Contracts\LINGYUN.Abp.ProjectManagement.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,35 @@ |
|||
using LINGYUN.Abp.ProjectManagement.Localization; |
|||
using Localization.Resources.AbpUi; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.ProjectManagement |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAspNetCoreMvcModule), |
|||
typeof(AbpProjectManagementApplicationContractsModule))] |
|||
public class AbpProjectManagementHttpApiModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
PreConfigure<IMvcBuilder>(mvcBuilder => |
|||
{ |
|||
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpProjectManagementHttpApiModule).Assembly); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<AbpProjectManagementResource>() |
|||
.AddBaseTypes( |
|||
typeof(AbpUiResource) |
|||
); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue