Interface IBlogRepository
- Namespace
- Builvero.Application.Interfaces.Repositories
- Assembly
- Builvero.Application.dll
Defines the contract for blog post data access operations including retrieval, creation, updates, and deletion.
public interface IBlogRepository
Methods
CreateAsync(BlogPost, CancellationToken)
Creates a new blog post entity in the database.
Task<BlogPost> CreateAsync(BlogPost blogPost, CancellationToken cancellationToken = default)
Parameters
blogPostBlogPostThe blog post entity to create.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
DeleteAsync(BlogPost, CancellationToken)
Deletes a blog post entity from the database.
Task DeleteAsync(BlogPost blogPost, CancellationToken cancellationToken = default)
Parameters
blogPostBlogPostThe blog post entity to delete.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
- Defines the contract for blog post data access operations including retrieval, creation, updates, and deletion.
GetAllAsync(bool, CancellationToken)
Retrieves all blog posts, optionally filtered by publication status.
Task<List<BlogPost>> GetAllAsync(bool publishedOnly = false, CancellationToken cancellationToken = default)
Parameters
publishedOnlyboolIf true, returns only published posts; otherwise returns all posts.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
GetByIdAsync(Guid, CancellationToken)
Retrieves a blog post by its unique identifier.
Task<BlogPost?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe unique identifier of the blog post to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
GetBySlugAsync(string, CancellationToken)
Retrieves a blog post by its slug.
Task<BlogPost?> GetBySlugAsync(string slug, CancellationToken cancellationToken = default)
Parameters
slugstringThe slug of the blog post to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
SlugExistsAsync(string, Guid?, CancellationToken)
Checks if a slug already exists in the database.
Task<bool> SlugExistsAsync(string slug, Guid? excludeId = null, CancellationToken cancellationToken = default)
Parameters
slugstringThe slug to check.
excludeIdGuid?Optional blog post ID to exclude from the check (for updates).
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
UpdateAsync(BlogPost, CancellationToken)
Updates an existing blog post entity in the database.
Task<BlogPost> UpdateAsync(BlogPost blogPost, CancellationToken cancellationToken = default)
Parameters
blogPostBlogPostThe blog post entity with updated values.
cancellationTokenCancellationTokenCancellation token to cancel the operation.