Browse Source

CmsKit - Remove unnecessary Blog Existence check in BlogPostManager

pull/7955/head
enisn 6 years ago
parent
commit
8592b70395
  1. 8
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs

8
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs

@ -34,14 +34,6 @@ namespace Volo.CmsKit.Blogs
Check.NotNullOrEmpty(title, nameof(title)); Check.NotNullOrEmpty(title, nameof(title));
Check.NotNullOrEmpty(slug, nameof(slug)); Check.NotNullOrEmpty(slug, nameof(slug));
/* TODO: BlogRepository.GetAsync already throws the same exception.
So, if you get Blog you don't have to check its existence.
Actually, you SHOULD not check. What if I've created the Blog, but
not saved to database, and I am creating a post inside it in same UOW.
In this case, you throw an unnecessary exception.
*/
await CheckBlogExistenceAsync(blog.Id);
var blogPost = new BlogPost( var blogPost = new BlogPost(
GuidGenerator.Create(), GuidGenerator.Create(),
blog.Id, blog.Id,

Loading…
Cancel
Save