Interface IRatingRepository
This interface represents the data access layer for ratings that exposes functionality to rate items, delete ratings and retrieve user ratings and statistics from an underlying rating store.
Namespace: EPiServer.Social.Ratings.Core
Assembly: EPiServer.Social.Ratings.Core.dll
Version: 1.5.4Syntax
public interface IRatingRepository
Methods
Add(Rating)
Adds a new rating for an item by the specified user.
Declaration
Rating Add(Rating rating)
Parameters
| Type | Name | Description |
|---|---|---|
| Rating | rating | Rating to add. |
Returns
| Type | Description |
|---|---|
| Rating |
Add<TExtension>(Rating, TExtension)
Adds a new rating with extension metadata for an item by the specified user.
Declaration
Composite<Rating, TExtension> Add<TExtension>(Rating rating, TExtension extension)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| Rating | rating | Rating to be added. |
| TExtension | extension | Extended data supporting the rating |
Returns
| Type | Description |
|---|---|
| Composite<Rating, TExtension> | An rating composed with the specified extension data |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data applied as an extension of the rating |
AddAsync(Rating)
Asynchronously add a new rating for an item by the specified user.
Declaration
Task<Rating> AddAsync(Rating rating)
Parameters
| Type | Name | Description |
|---|---|---|
| Rating | rating | Rating to add. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Rating> |
AddAsync<TExtension>(Rating, TExtension)
Adds a new rating with extension metadata for an item by the specified user.
Declaration
Task<Composite<Rating, TExtension>> AddAsync<TExtension>(Rating rating, TExtension extension)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| Rating | rating | Rating to be added. |
| TExtension | extension | Extended data supporting the rating |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Composite<Rating, TExtension>> | An rating composed with the specified extension data |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data applied as an extension of the rating |
Get(Criteria<RatingFilter>)
Gets a page of ratings from the underlying data store, as described by the specified criteria.
Declaration
ResultPage<Rating> Get(Criteria<RatingFilter> criteria)
Parameters
| Type | Name | Description |
|---|---|---|
| Criteria<RatingFilter> | criteria | Criteria by which to filter ratings |
Returns
| Type | Description |
|---|---|
| ResultPage<Rating> | Page of ratings |
Get(Criteria<RatingStatisticsFilter>)
Gets a page of rating statistics from the underlying data store, as described by the specified criteria.
Declaration
[Obsolete("This API is deprecated. Please use: RatingStatisticsRepository:Get(Criteria<RatingStatisticsFilter> criteria)")]
ResultPage<RatingStatistics> Get(Criteria<RatingStatisticsFilter> criteria)
Parameters
| Type | Name | Description |
|---|---|---|
| Criteria<RatingStatisticsFilter> | criteria | Criteria by which to filter rating statistics |
Returns
| Type | Description |
|---|---|
| ResultPage<RatingStatistics> | Page of rating statistics |
Get(RatingId)
Retrieve an existing rating by its identifier.
Declaration
Rating Get(RatingId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to retrieve. |
Returns
| Type | Description |
|---|---|
| Rating |
Get<TExtension>(CompositeCriteria<RatingFilter, TExtension>)
Retrieves a page of ratings from the underlying data store, as described by the specified criteria. The ratings are filtered by the type of their associated data.
Declaration
ResultPage<Composite<Rating, TExtension>> Get<TExtension>(CompositeCriteria<RatingFilter, TExtension> criteria)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| CompositeCriteria<RatingFilter, TExtension> | criteria | Criteria by which to filter ratings |
Returns
| Type | Description |
|---|---|
| ResultPage<Composite<Rating, TExtension>> | Page of composite ratings |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data associated with the desired ratings |
Get<TExtension>(RatingId)
Gets a rating with extension data from the underlying data store described by its rating identifier.
Declaration
Composite<Rating, TExtension> Get<TExtension>(RatingId id)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to get. |
Returns
| Type | Description |
|---|---|
| Composite<Rating, TExtension> | The composite rating. |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data associated with the desired ratings |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | Thrown when invalid data passed for id. |
GetAsync(Criteria<RatingFilter>)
Gets a page of ratings from the underlying data store, as described by the specified criteria.
Declaration
Task<ResultPage<Rating>> GetAsync(Criteria<RatingFilter> criteria)
Parameters
| Type | Name | Description |
|---|---|---|
| Criteria<RatingFilter> | criteria | Criteria by which to filter ratings |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ResultPage<Rating>> | Page of ratings |
GetAsync(Criteria<RatingStatisticsFilter>)
Gets a page of rating statistics from the underlying data store, as described by the specified criteria.
Declaration
[Obsolete("This API is deprecated. Please use: RatingStatisticsRepository:GetAsync(Criteria<RatingStatisticsFilter> criteria)")]
Task<ResultPage<RatingStatistics>> GetAsync(Criteria<RatingStatisticsFilter> criteria)
Parameters
| Type | Name | Description |
|---|---|---|
| Criteria<RatingStatisticsFilter> | criteria | Criteria by which to filter rating statistics |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ResultPage<RatingStatistics>> | Page of rating statistics |
GetAsync(RatingId)
Retrieve an existing rating by its identifier.
Declaration
Task<Rating> GetAsync(RatingId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to retrieve. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Rating> |
GetAsync<TExtension>(CompositeCriteria<RatingFilter, TExtension>)
Retrieves a page of ratings from the underlying data store, as described by the specified criteria. The ratings are filtered by the type of their associated data.
Declaration
Task<ResultPage<Composite<Rating, TExtension>>> GetAsync<TExtension>(CompositeCriteria<RatingFilter, TExtension> criteria)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| CompositeCriteria<RatingFilter, TExtension> | criteria | Criteria by which to filter ratings |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ResultPage<Composite<Rating, TExtension>>> | Page of composite ratings |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data associated with the desired ratings |
GetAsync<TExtension>(RatingId)
Gets a rating with extension data from the underlying data store described by its rating identifier.
Declaration
Task<Composite<Rating, TExtension>> GetAsync<TExtension>(RatingId id)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to get. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Composite<Rating, TExtension>> | The composite rating. |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data associated with the desired ratings |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | Thrown when invalid data passed for id. |
Remove(RatingId)
Removes an existing rating by its rating identifiers.
Declaration
void Remove(RatingId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to remove. |
RemoveAsync(RatingId)
Removes an existing rating by its rating identifiers.
Declaration
Task RemoveAsync(RatingId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to remove. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Update(RatingId, RatingValue, RatingValue)
Updates the rating value of an existing rating.
Declaration
Rating Update(RatingId id, RatingValue currentValue, RatingValue newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to update. |
| RatingValue | currentValue | The current value of the identified rating. This value is used to ensure consistency in statistical calculations. |
| RatingValue | newValue | The new rating value to set in the rating. |
Returns
| Type | Description |
|---|---|
| Rating |
Update<TExtension>(RatingId, RatingValue, RatingValue, TExtension)
Updates the rating value for an existing rating with extension metadata.
Declaration
Composite<Rating, TExtension> Update<TExtension>(RatingId id, RatingValue currentValue, RatingValue newValue, TExtension extension)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to update. |
| RatingValue | currentValue | The current value of the identified rating. This value is used to ensure consistency in statistical calculations. |
| RatingValue | newValue | The new rating value to set in the rating. |
| TExtension | extension | Extended data supporting the rating |
Returns
| Type | Description |
|---|---|
| Composite<Rating, TExtension> | An rating composed with the specified extension data |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data applied as an extension of the rating |
UpdateAsync(RatingId, RatingValue, RatingValue)
Updates the rating value of an existing rating.
Declaration
Task<Rating> UpdateAsync(RatingId id, RatingValue currentValue, RatingValue newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to update. |
| RatingValue | currentValue | The current value of the identified rating. This value is used to ensure consistency in statistical calculations. |
| RatingValue | newValue | The new rating value to set in the rating. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Rating> |
UpdateAsync<TExtension>(RatingId, RatingValue, RatingValue, TExtension)
Updates the rating value for an existing rating with extension metadata.
Declaration
Task<Composite<Rating, TExtension>> UpdateAsync<TExtension>(RatingId id, RatingValue currentValue, RatingValue newValue, TExtension extension)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| RatingId | id | Identifier of the rating to update. |
| RatingValue | currentValue | The current value of the identified rating. This value is used to ensure consistency in statistical calculations. |
| RatingValue | newValue | The new rating value to set in the rating. |
| TExtension | extension | Extended data supporting the rating |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Composite<Rating, TExtension>> | An rating composed with the specified extension data |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of data applied as an extension of the rating |