mirror of https://github.com/abpframework/abp.git
7 changed files with 131 additions and 2 deletions
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Blogging.Blogs |
|||
{ |
|||
[Serializable] |
|||
public class BlogEto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
[NotNull] |
|||
public string Name { get; set; } |
|||
|
|||
[NotNull] |
|||
public string ShortName { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string Description { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Blogging.Comments |
|||
{ |
|||
[Serializable] |
|||
public class CommentEto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
public Guid PostId { get; set; } |
|||
|
|||
public Guid? RepliedCommentId { get; set; } |
|||
|
|||
public string Text { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
using JetBrains.Annotations; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Blogging.Tagging; |
|||
|
|||
namespace Volo.Blogging.Posts |
|||
{ |
|||
[Serializable] |
|||
public class PostEto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
public Guid BlogId { get; set; } |
|||
|
|||
[NotNull] |
|||
public string Url { get; set; } |
|||
|
|||
[NotNull] |
|||
public string CoverImage { get; set; } |
|||
|
|||
[NotNull] |
|||
public string Title { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string Content { get; set; } |
|||
|
|||
public int ReadCount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Blogging.Tagging |
|||
{ |
|||
[Serializable] |
|||
public class TagEto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
public Guid BlogId { get; set; } |
|||
|
|||
[NotNull] |
|||
public string Name { get; set; } |
|||
|
|||
public string Description { get; set; } |
|||
|
|||
public int UsageCount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using AutoMapper; |
|||
using Volo.Blogging.Blogs; |
|||
using Volo.Blogging.Comments; |
|||
using Volo.Blogging.Posts; |
|||
using Volo.Blogging.Tagging; |
|||
|
|||
namespace Volo.Blogging |
|||
{ |
|||
public class BloggingDomainMappingProfile : Profile |
|||
{ |
|||
public BloggingDomainMappingProfile() |
|||
{ |
|||
CreateMap<Blog, BlogEto>(); |
|||
CreateMap<Comment, CommentEto>(); |
|||
CreateMap<Post, PostEto>(); |
|||
CreateMap<Tag, TagEto>(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,13 +1,37 @@ |
|||
using Volo.Abp.Domain; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Domain; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Blogging.Blogs; |
|||
using Volo.Blogging.Comments; |
|||
using Volo.Blogging.Posts; |
|||
using Volo.Blogging.Tagging; |
|||
|
|||
namespace Volo.Blogging |
|||
{ |
|||
[DependsOn( |
|||
typeof(BloggingDomainSharedModule), |
|||
typeof(AbpDddDomainModule))] |
|||
typeof(AbpDddDomainModule), |
|||
typeof(AbpAutoMapperModule))] |
|||
public class BloggingDomainModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAutoMapperObjectMapper<BloggingDomainModule>(); |
|||
|
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddProfile<BloggingDomainMappingProfile>(validate: true); |
|||
}); |
|||
|
|||
Configure<AbpDistributedEventBusOptions>(options => |
|||
{ |
|||
options.EtoMappings.Add<Blog, BlogEto>(typeof(BloggingDomainModule)); |
|||
options.EtoMappings.Add<Comment, CommentEto>(typeof(BloggingDomainModule)); |
|||
options.EtoMappings.Add<Post, PostEto>(typeof(BloggingDomainModule)); |
|||
options.EtoMappings.Add<Tag, TagEto>(typeof(BloggingDomainModule)); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue