Class ContentRepository
- Namespace
- Biwen.QuickApi.Contents
- Assembly
- Biwen.QuickApi.Contents.dll
public class ContentRepository : IContentRepository
- Inheritance
-
ContentRepository
- Implements
-
- Inherited Members
-
- Extension Methods
-
Constructors
ContentRepository(ContentSerializer, IContentDbContext, IPublisher, IContentSchemaGenerator)
public ContentRepository(ContentSerializer serializer, IContentDbContext dbContext, IPublisher publisher, IContentSchemaGenerator schemaGenerator)
Parameters
serializer ContentSerializer
dbContext IContentDbContext
publisher IPublisher
schemaGenerator IContentSchemaGenerator
Methods
DeleteContentAsync(Guid)
public Task DeleteContentAsync(Guid id)
Parameters
id Guid
Returns
- Task
GetContentAsync<T>(Guid)
public Task<T?> GetContentAsync<T>(Guid id) where T : IContent, new()
Parameters
id Guid
Returns
- Task<T>
Type Parameters
T
GetContentIdBySlugAsync(string)
public Task<Content?> GetContentIdBySlugAsync(string slug)
Parameters
slug string
Returns
- Task<Content>
GetContentSchema<T>()
public string GetContentSchema<T>() where T : IContent
Returns
- string
Type Parameters
T
GetContentsByTypeAsync<T>(int, int)
public Task<IPagedList<T>> GetContentsByTypeAsync<T>(int pageIndex = 0, int len = 10) where T : IContent, new()
Parameters
pageIndex int
len int
Returns
- Task<IPagedList<T>>
Type Parameters
T
GetContentsByTypeAsync<T>(string)
public Task<T?> GetContentsByTypeAsync<T>(string slug) where T : IContent, new()
Parameters
slug string
Returns
- Task<T>
Type Parameters
T
GetDomainContentsByTypeAsync<T>(string?, int, int, int?, string?)
public Task<IPagedList<Content>> GetDomainContentsByTypeAsync<T>(string? slug = null, int pageIndex = 0, int len = 10, int? status = null, string? title = null) where T : IContent, new()
Parameters
slug string
pageIndex int
len int
status int?
title string
Returns
- Task<IPagedList<Content>>
Type Parameters
T
GetRawContentAsync(Guid)
public Task<Content> GetRawContentAsync(Guid id)
Parameters
id Guid
Returns
- Task<Content>
SaveContentAsync<T>(T, string?, string?)
public Task<Guid> SaveContentAsync<T>(T content, string? title = null, string? slug = null) where T : IContent
Parameters
content T
title string
slug string
Returns
- Task<Guid>
Type Parameters
T
SetContentStatusAsync(Guid, ContentStatus)
public Task SetContentStatusAsync(Guid id, ContentStatus status)
Parameters
id Guid
status ContentStatus
Returns
- Task
UpdateContentAsync<T>(Guid, T)
public Task UpdateContentAsync<T>(Guid id, T content) where T : IContent
Parameters
id Guid
content T
Returns
- Task
Type Parameters
T
UpdateRawContentAsync(Content, bool, int)
public Task UpdateRawContentAsync(Content content, bool isRollback = false, int version = 0)
Parameters
content Content
isRollback bool
version int
Returns
- Task