mirror of https://github.com/abpframework/abp.git
120 changed files with 4672 additions and 2601 deletions
@ -1,26 +1,33 @@ |
|||
// using JetBrains.Annotations;
|
|||
// using Microsoft.EntityFrameworkCore;
|
|||
// using System;
|
|||
// using Oracle.EntityFrameworkCore.Infrastructure;
|
|||
// using Volo.Abp.EntityFrameworkCore.DependencyInjection;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpDbContextConfigurationContextOracleExtensions
|
|||
// {
|
|||
// public static DbContextOptionsBuilder UseOracle(
|
|||
// [NotNull] this AbpDbContextConfigurationContext context,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
|
|||
// {
|
|||
// TODO: UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
|
|||
// if (context.ExistingConnection != null)
|
|||
// {
|
|||
// return context.DbContextOptions.UseOracle(context.ExistingConnection, oracleOptionsAction);
|
|||
// }
|
|||
// else
|
|||
// {
|
|||
// return context.DbContextOptions.UseOracle(context.ConnectionString, oracleOptionsAction);
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
using JetBrains.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using Oracle.EntityFrameworkCore.Infrastructure; |
|||
using Volo.Abp.EntityFrameworkCore.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class AbpDbContextConfigurationContextOracleExtensions |
|||
{ |
|||
public static DbContextOptionsBuilder UseOracle( |
|||
[NotNull] this AbpDbContextConfigurationContext context, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null) |
|||
{ |
|||
if (context.ExistingConnection != null) |
|||
{ |
|||
return context.DbContextOptions.UseOracle(context.ExistingConnection, optionsBuilder => |
|||
{ |
|||
optionsBuilder.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery); |
|||
oracleOptionsAction?.Invoke(optionsBuilder); |
|||
}); |
|||
} |
|||
else |
|||
{ |
|||
return context.DbContextOptions.UseOracle(context.ConnectionString, optionsBuilder => |
|||
{ |
|||
optionsBuilder.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery); |
|||
oracleOptionsAction?.Invoke(optionsBuilder); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,30 +1,30 @@ |
|||
// using JetBrains.Annotations;
|
|||
// using System;
|
|||
// using Oracle.EntityFrameworkCore.Infrastructure;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpDbContextOptionsOracleExtensions
|
|||
// {
|
|||
// public static void UseOracle(
|
|||
// [NotNull] this AbpDbContextOptions options,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
|
|||
// {
|
|||
// options.Configure(context =>
|
|||
// {
|
|||
// context.UseOracle(oracleOptionsAction);
|
|||
// });
|
|||
// }
|
|||
//
|
|||
// public static void UseOracle<TDbContext>(
|
|||
// [NotNull] this AbpDbContextOptions options,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
|
|||
// where TDbContext : AbpDbContext<TDbContext>
|
|||
// {
|
|||
// options.Configure<TDbContext>(context =>
|
|||
// {
|
|||
// context.UseOracle(oracleOptionsAction);
|
|||
// });
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
using JetBrains.Annotations; |
|||
using System; |
|||
using Oracle.EntityFrameworkCore.Infrastructure; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class AbpDbContextOptionsOracleExtensions |
|||
{ |
|||
public static void UseOracle( |
|||
[NotNull] this AbpDbContextOptions options, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null) |
|||
{ |
|||
options.Configure(context => |
|||
{ |
|||
context.UseOracle(oracleOptionsAction); |
|||
}); |
|||
} |
|||
|
|||
public static void UseOracle<TDbContext>( |
|||
[NotNull] this AbpDbContextOptions options, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null) |
|||
where TDbContext : AbpDbContext<TDbContext> |
|||
{ |
|||
options.Configure<TDbContext>(context => |
|||
{ |
|||
context.UseOracle(oracleOptionsAction); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,22 +1,20 @@ |
|||
// using Volo.Abp.Guids;
|
|||
// using Volo.Abp.Modularity;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore.Oracle
|
|||
// {
|
|||
// [DependsOn(
|
|||
// typeof(AbpEntityFrameworkCoreModule)
|
|||
// )]
|
|||
// public class AbpEntityFrameworkCoreOracleModule : AbpModule
|
|||
// {
|
|||
// public override void ConfigureServices(ServiceConfigurationContext context)
|
|||
// {
|
|||
// Configure<AbpSequentialGuidGeneratorOptions>(options =>
|
|||
// {
|
|||
// if (options.DefaultSequentialGuidType == null)
|
|||
// {
|
|||
// options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary;
|
|||
// }
|
|||
// });
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Oracle |
|||
{ |
|||
[DependsOn(typeof(AbpEntityFrameworkCoreModule))] |
|||
public class AbpEntityFrameworkCoreOracleModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpSequentialGuidGeneratorOptions>(options => |
|||
{ |
|||
if (options.DefaultSequentialGuidType == null) |
|||
{ |
|||
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.MongoDB |
|||
{ |
|||
public class AbpMongoDbContextOptions |
|||
{ |
|||
internal Dictionary<Type, Type> DbContextReplacements { get; } |
|||
|
|||
public AbpMongoDbContextOptions() |
|||
{ |
|||
DbContextReplacements = new Dictionary<Type, Type>(); |
|||
} |
|||
|
|||
internal Type GetReplacedTypeOrSelf(Type dbContextType) |
|||
{ |
|||
var replacementType = dbContextType; |
|||
while (true) |
|||
{ |
|||
if (DbContextReplacements.TryGetValue(replacementType, out var foundType)) |
|||
{ |
|||
if (foundType == dbContextType) |
|||
{ |
|||
throw new AbpException( |
|||
"Circular DbContext replacement found for " + |
|||
dbContextType.AssemblyQualifiedName |
|||
); |
|||
} |
|||
|
|||
replacementType = foundType; |
|||
} |
|||
else |
|||
{ |
|||
return replacementType; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,46 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Volo.CmsKit.Migrations |
|||
{ |
|||
public partial class PageSlugChange : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "CmsPages", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
Title = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|||
Slug = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false), |
|||
Description = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_CmsPages", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_CmsPages_TenantId_Slug", |
|||
table: "CmsPages", |
|||
columns: new[] { "TenantId", "Slug" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "CmsPages"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -1,10 +0,0 @@ |
|||
using System; |
|||
|
|||
namespace Volo.CmsKit.Admin.Blogs |
|||
{ |
|||
public class BlogLookupDto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
public string Name { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Abp.Validation; |
|||
using Volo.CmsKit.Blogs; |
|||
|
|||
namespace Volo.CmsKit.Admin.Blogs |
|||
{ |
|||
public class UpdateBlogPostDto |
|||
{ |
|||
[Required] |
|||
[DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxTitleLength))] |
|||
public string Title { get; set; } |
|||
|
|||
[Required] |
|||
[DynamicStringLength( |
|||
typeof(BlogPostConsts), |
|||
nameof(BlogPostConsts.MaxSlugLength), |
|||
nameof(BlogPostConsts.MinSlugLength))] |
|||
public string Slug { get; set; } |
|||
|
|||
[DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] |
|||
public string ShortDescription { get; set; } |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
|
|||
namespace Volo.CmsKit.Pages |
|||
{ |
|||
[Serializable] |
|||
public class PageSlugAlreadyExistsException : BusinessException |
|||
{ |
|||
public PageSlugAlreadyExistsException([NotNull] string slug) |
|||
{ |
|||
Code = CmsKitErrorCodes.Pages.SlugAlreadyExist; |
|||
WithData(nameof(Page.Slug), slug); |
|||
} |
|||
|
|||
public PageSlugAlreadyExistsException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.Serialization; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
|
|||
namespace Volo.CmsKit.Pages |
|||
{ |
|||
[Serializable] |
|||
public class PageUrlAlreadyExistException : BusinessException |
|||
{ |
|||
public PageUrlAlreadyExistException([NotNull] string url) |
|||
{ |
|||
Code = CmsKitErrorCodes.Pages.UrlAlreadyExist; |
|||
WithData(nameof(Page.Url), url); |
|||
} |
|||
|
|||
public PageUrlAlreadyExistException(SerializationInfo serializationInfo, StreamingContext context) |
|||
: base(serializationInfo, context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,27 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.CmsKit.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Pages |
|||
{ |
|||
public class PageAppService : CmsKitPublicAppServiceBase, IPageAppService |
|||
{ |
|||
protected readonly IPageRepository PageRepository; |
|||
|
|||
public PageAppService(IPageRepository pageRepository) |
|||
{ |
|||
PageRepository = pageRepository; |
|||
} |
|||
|
|||
public virtual async Task<PageDto> FindByUrlAsync(string url) |
|||
{ |
|||
var page = await PageRepository.FindByUrlAsync(url); |
|||
|
|||
if (page == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
return ObjectMapper.Map<Page, PageDto>(page); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.CmsKit.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Pages |
|||
{ |
|||
public class PagePublicAppService : CmsKitPublicAppServiceBase, IPagePublicAppService |
|||
{ |
|||
protected IPageRepository PageRepository { get; } |
|||
|
|||
public PagePublicAppService(IPageRepository pageRepository) |
|||
{ |
|||
PageRepository = pageRepository; |
|||
} |
|||
|
|||
public virtual async Task<PageDto> FindBySlugAsync(string slug) |
|||
{ |
|||
PageDto pageDto = null; |
|||
var page = await PageRepository.FindBySlugAsync(slug); |
|||
|
|||
if (page !=null) |
|||
{ |
|||
pageDto = ObjectMapper.Map<Page, PageDto>(page); |
|||
} |
|||
|
|||
return pageDto; |
|||
} |
|||
} |
|||
} |
|||
@ -1,26 +1,29 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.GlobalFeatures; |
|||
using Volo.CmsKit.GlobalFeatures; |
|||
|
|||
namespace Volo.CmsKit.Public.Pages |
|||
{ |
|||
[RequiresGlobalFeature(typeof(PagesFeature))] |
|||
[RemoteService(Name = CmsKitPublicRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("cms-kit")] |
|||
[Route("api/cms-kit-public/comments")] |
|||
public class PagesPublicController : IPageAppService |
|||
[Route("api/cms-kit-public/pages")] |
|||
public class PagesPublicController : IPagePublicAppService |
|||
{ |
|||
protected readonly IPageAppService PageAppService; |
|||
protected IPagePublicAppService PageAppService { get; } |
|||
|
|||
public PagesPublicController(IPageAppService pageAppService) |
|||
public PagesPublicController(IPagePublicAppService pageAppService) |
|||
{ |
|||
PageAppService = pageAppService; |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("url/{url}")] |
|||
public Task<PageDto> FindByUrlAsync(string url) |
|||
[Route("{slug}")] |
|||
public virtual Task<PageDto> FindBySlugAsync(string slug) |
|||
{ |
|||
return PageAppService.FindByUrlAsync(url); |
|||
return PageAppService.FindBySlugAsync(slug); |
|||
} |
|||
} |
|||
} |
|||
@ -1,37 +0,0 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.ActionConstraints; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.GlobalFeatures; |
|||
using Volo.CmsKit.GlobalFeatures; |
|||
using Volo.CmsKit.Public.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Web.Controllers |
|||
{ |
|||
[RequiresGlobalFeature(typeof(PagesFeature))] |
|||
public class PageController : CmsKitPublicControllerBase |
|||
{ |
|||
protected IPageAppService PageAppService { get; } |
|||
|
|||
public PageController(IPageAppService pageAppService) |
|||
{ |
|||
PageAppService = pageAppService; |
|||
} |
|||
|
|||
//[HttpGet("/{*url}", Order = int.MaxValue)]
|
|||
public async Task<IActionResult> IndexAsync(string url) |
|||
{ |
|||
var page = await PageAppService.FindByUrlAsync(url); |
|||
|
|||
if (page == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return View("~/Views/Page/Index.cshtml", page); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
@page |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.CmsKit.Localization |
|||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages |
|||
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Pages.IndexModel |
|||
@inject IHtmlLocalizer<CmsKitResource> L |
|||
|
|||
@await Component.InvokeAsync(typeof(DefaultPageViewComponent), |
|||
new |
|||
{ |
|||
pageId = Model.Page.Id, |
|||
title = Model.Page.Title |
|||
}) |
|||
@ -0,0 +1,34 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.CmsKit.Public.Pages; |
|||
using Volo.CmsKit.Web.Pages; |
|||
|
|||
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Pages |
|||
{ |
|||
public class IndexModel : CommonPageModel |
|||
{ |
|||
[BindProperty(SupportsGet = true)] |
|||
public string Slug { get; set; } |
|||
|
|||
protected IPagePublicAppService PagePublicAppService { get; } |
|||
|
|||
public PageDto Page; |
|||
|
|||
public IndexModel(IPagePublicAppService pagePublicAppService) |
|||
{ |
|||
PagePublicAppService = pagePublicAppService; |
|||
} |
|||
|
|||
public async Task<IActionResult> OnGetAsync() |
|||
{ |
|||
Page = await PagePublicAppService.FindBySlugAsync(Slug); |
|||
|
|||
if (Page == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return Page(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
@model Volo.CmsKit.Public.Pages.PageDto |
|||
|
|||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages |
|||
|
|||
@await Component.InvokeAsync(typeof(DefaultPageViewComponent), new |
|||
{ |
|||
pageId = Model.Id, |
|||
title = Model.Title |
|||
}) |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue