mirror of https://github.com/abpframework/abp.git
12 changed files with 92 additions and 70 deletions
@ -1,14 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; |
|
||||
|
|
||||
namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents |
|
||||
{ |
|
||||
public interface IContentRenderer |
|
||||
{ |
|
||||
Task<string> RenderAsync(string content); |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; |
|
||||
|
|
||||
namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents |
|
||||
{ |
|
||||
public interface IContentRendererProvider |
|
||||
{ |
|
||||
Task<IContentRenderer> GetContentRendererAsync(IEntityContent content); |
|
||||
} |
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.DependencyInjection; |
|
||||
using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; |
|
||||
using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; |
|
||||
|
|
||||
namespace Volo.CmsKit.Common.Application.Volo.CmsKit.Contents |
|
||||
{ |
|
||||
public class PlainTextRenderer : IContentRenderer, ITransientDependency |
|
||||
{ |
|
||||
public Task<string> RenderAsync(IContent content) |
|
||||
{ |
|
||||
return Task.FromResult(content?.Value); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,9 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.CmsKit.Web.Contents |
||||
|
{ |
||||
|
public interface IContentRenderer |
||||
|
{ |
||||
|
Task<string> RenderAsync(string value); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace Volo.CmsKit.Web.Contents |
||||
|
{ |
||||
|
public class PlainTextContentRenderer : IContentRenderer, ITransientDependency |
||||
|
{ |
||||
|
public Task<string> RenderAsync(string value) |
||||
|
{ |
||||
|
return Task.FromResult(value); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
using Volo.CmsKit.Entities; |
||||
|
|
||||
|
namespace Volo.CmsKit.Contents |
||||
|
{ |
||||
|
public static class ContentConsts |
||||
|
{ |
||||
|
public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength; |
||||
|
|
||||
|
public static int MaxEntityIdLength { get; set; } = CmsEntityConsts.MaxEntityIdLength; |
||||
|
|
||||
|
// TODO: consider
|
||||
|
public static int MaxValueLength = int.MaxValue; |
||||
|
} |
||||
|
} |
||||
@ -1,7 +0,0 @@ |
|||||
namespace Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents |
|
||||
{ |
|
||||
public interface IContent |
|
||||
{ |
|
||||
string Value { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
namespace Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents |
|
||||
{ |
|
||||
public interface IEntityContent : IContent |
|
||||
{ |
|
||||
string EntityType { get; set; } |
|
||||
string EntityId { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,17 +1,27 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using JetBrains.Annotations; |
||||
using System.Linq; |
using Volo.Abp; |
||||
using System.Text; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
using Volo.Abp.Domain.Entities.Auditing; |
||||
using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; |
|
||||
|
|
||||
namespace Volo.CmsKit.Domain.Volo.CmsKit.Contents |
namespace Volo.CmsKit.Contents |
||||
{ |
{ |
||||
public class Content : FullAuditedAggregateRoot<Guid> |
public class Content : FullAuditedAggregateRoot<Guid> |
||||
{ |
{ |
||||
public string Value { get; set; } |
|
||||
public string EntityType { get; set; } |
public string EntityType { get; set; } |
||||
|
|
||||
public string EntityId { get; set; } |
public string EntityId { get; set; } |
||||
|
|
||||
|
public string Value { get; set; } |
||||
|
|
||||
|
protected Content() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value) : base(id) |
||||
|
{ |
||||
|
EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength); |
||||
|
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength); |
||||
|
Value = Check.NotNullOrWhiteSpace(value, nameof(value), ContentConsts.MaxValueLength); |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Volo.CmsKit.Contents |
||||
|
{ |
||||
|
public interface IContentRepository : IBasicRepository<Content, Guid> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Volo.CmsKit.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Volo.CmsKit.Contents |
||||
|
{ |
||||
|
public class EfCoreContentRepository : EfCoreRepository<ICmsKitDbContext, Content, Guid>, IContentRepository |
||||
|
{ |
||||
|
public EfCoreContentRepository(IDbContextProvider<ICmsKitDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories.MongoDB; |
||||
|
using Volo.Abp.MongoDB; |
||||
|
using Volo.CmsKit.Contents; |
||||
|
|
||||
|
namespace Volo.CmsKit.MongoDB.Contents |
||||
|
{ |
||||
|
public class MongoContentRepository : MongoDbRepository<ICmsKitMongoDbContext, Content, Guid>, IContentRepository |
||||
|
{ |
||||
|
public MongoContentRepository(IMongoDbContextProvider<ICmsKitMongoDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue