C# Класс PhotoSharingApp.AppService.Shared.Repositories.CachedRepository

A repository that uses a cache for some repository calls.
Наследование: IRepository
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CachedRepository ( IRepository repository, ICacheService cacheService ) : System.Collections.Generic

Creates a new instance.

CreateCategory ( string name ) : Task

Creates a new category with the provided name.

CreateUser ( string registrationReference ) : Task

Inserts a new user record in the database.

DeleteAnnotation ( string annotationId, string userRegistrationReference ) : System.Threading.Tasks.Task

Deletes an annotation.

DeletePhoto ( string photoId, string userRegistrationReference ) : System.Threading.Tasks.Task

Deletes all the data for the provided photo id.

Dispose ( ) : void

Releases resources.

GetCategories ( ) : Task>

Fetches all the categories and sorts them by name.

GetCategoriesPreview ( int numberOfThumbnails ) : Task>

Retrieves all the categories that have atleast one photo and also retrieves number of provided thumbnails for the photos in each category.

GetCategoryPhotoStream ( string categoryId, string continuationToken ) : Task>

Fetches the photo stream data for a provided category.

GetHeroPhotos ( int count, int daysOld ) : Task>

Gets hero photos.

GetLeaderboard ( int mostGoldCategoriesCount, int mostGoldPhotosCount, int mostGoldUsersCount, int mostGivingUsersCount ) : Task

Gets the leaderboard data.

GetPhoto ( string id ) : Task

Gets the photo data for provided photo id.

GetPhotosWithStatus ( PhotoStatus status ) : Task>

Gets the list of photos with a specific status.

GetUser ( string userId, string registrationReference = null ) : Task

Gets the user by an existing app user id OR registrationReference from Azure App Services auth mechanism as the userId may not be known at time of entry.

GetUserPhotoStream ( string userId, string continuationToken, bool includeNonActivePhotos = false ) : Task>

Fetches the photo stream data for a specified user.

InitializeDatabaseIfNotExisting ( string serverPath ) : System.Threading.Tasks.Task

Checks if the database exists and initializes it if it doesn't.

InsertAnnotation ( AnnotationContract annotation ) : Task

Inserts the annotation object and performs the required gold transactions.

InsertIapPurchase ( IapPurchaseContract validatedIapReciept ) : Task

Inserts receipt and adds gold to user.

InsertPhoto ( PhotoContract photo, int goldIncrement ) : Task

Insert the photo object into storage.

InsertReport ( ReportContract report, string userRegistrationReference ) : Task

Inserts a report into Report table.

ReinitializeDatabase ( string serverPath ) : System.Threading.Tasks.Task

Forces a reinitalization of the database, deleting any existing data.

UpdatePhoto ( PhotoContract photoContract ) : Task

Updates an existing photo object's category and description fields.

UpdatePhotoStatus ( PhotoContract photoContract ) : Task

Updates the status of the stored photo.

UpdateUser ( UserContract user ) : Task

Updates the user profile picture. User gold balance is also updated if it is the first time the user is updating their profile picture.

Описание методов

CachedRepository() публичный Метод

Creates a new instance.
public CachedRepository ( IRepository repository, ICacheService cacheService ) : System.Collections.Generic
repository IRepository The repository.
cacheService ICacheService The cache service.
Результат System.Collections.Generic

CreateCategory() публичный Метод

Creates a new category with the provided name.
public CreateCategory ( string name ) : Task
name string The category name to be created.
Результат Task

CreateUser() публичный Метод

Inserts a new user record in the database.
public CreateUser ( string registrationReference ) : Task
registrationReference string The Azure Mobile Service user id.
Результат Task

DeleteAnnotation() публичный Метод

Deletes an annotation.
public DeleteAnnotation ( string annotationId, string userRegistrationReference ) : System.Threading.Tasks.Task
annotationId string Id of annotation to be deleted.
userRegistrationReference string userRegistrationReference of annotation to be deleted.
Результат System.Threading.Tasks.Task

DeletePhoto() публичный Метод

Deletes all the data for the provided photo id.
public DeletePhoto ( string photoId, string userRegistrationReference ) : System.Threading.Tasks.Task
photoId string Id of the photo to be deleted.
userRegistrationReference string Azure Mobile Service user id.
Результат System.Threading.Tasks.Task

Dispose() публичный Метод

Releases resources.
public Dispose ( ) : void
Результат void

GetCategories() публичный Метод

Fetches all the categories and sorts them by name.
public GetCategories ( ) : Task>
Результат Task>

GetCategoriesPreview() публичный Метод

Retrieves all the categories that have atleast one photo and also retrieves number of provided thumbnails for the photos in each category.
public GetCategoriesPreview ( int numberOfThumbnails ) : Task>
numberOfThumbnails int Max number of thumbnails per category.
Результат Task>

GetCategoryPhotoStream() публичный Метод

Fetches the photo stream data for a provided category.
public GetCategoryPhotoStream ( string categoryId, string continuationToken ) : Task>
categoryId string THe category id.
continuationToken string Last captured ticks in the form of a string.
Результат Task>

GetHeroPhotos() публичный Метод

Gets hero photos.
public GetHeroPhotos ( int count, int daysOld ) : Task>
count int The number of hero photos.
daysOld int The number of days old the photos can be.
Результат Task>

GetLeaderboard() публичный Метод

Gets the leaderboard data.
public GetLeaderboard ( int mostGoldCategoriesCount, int mostGoldPhotosCount, int mostGoldUsersCount, int mostGivingUsersCount ) : Task
mostGoldCategoriesCount int Count of categories.
mostGoldPhotosCount int Count of photos.
mostGoldUsersCount int Count of wealthiest users.
mostGivingUsersCount int Count of most giving users.
Результат Task

GetPhoto() публичный Метод

Gets the photo data for provided photo id.
public GetPhoto ( string id ) : Task
id string The photo id.
Результат Task

GetPhotosWithStatus() публичный Метод

Gets the list of photos with a specific status.
public GetPhotosWithStatus ( PhotoStatus status ) : Task>
status PhotoStatus The photo status.
Результат Task>

GetUser() публичный Метод

Gets the user by an existing app user id OR registrationReference from Azure App Services auth mechanism as the userId may not be known at time of entry.
public GetUser ( string userId, string registrationReference = null ) : Task
userId string The app user id.
registrationReference string [Optional] The Azure App Service user id. Default value is null.
Результат Task

GetUserPhotoStream() публичный Метод

Fetches the photo stream data for a specified user.
public GetUserPhotoStream ( string userId, string continuationToken, bool includeNonActivePhotos = false ) : Task>
userId string The user id.
continuationToken string Last captured ticks in the form of a string.
includeNonActivePhotos bool By default, false. If true, non-active photos are included.
Результат Task>

InitializeDatabaseIfNotExisting() публичный Метод

Checks if the database exists and initializes it if it doesn't.
public InitializeDatabaseIfNotExisting ( string serverPath ) : System.Threading.Tasks.Task
serverPath string
Результат System.Threading.Tasks.Task

InsertAnnotation() публичный Метод

Inserts the annotation object and performs the required gold transactions.
public InsertAnnotation ( AnnotationContract annotation ) : Task
annotation PhotoSharingApp.Portable.DataContracts.AnnotationContract Annotation to be inserted.
Результат Task

InsertIapPurchase() публичный Метод

Inserts receipt and adds gold to user.
public InsertIapPurchase ( IapPurchaseContract validatedIapReciept ) : Task
validatedIapReciept PhotoSharingApp.Portable.DataContracts.IapPurchaseContract Validated receipt values.
Результат Task

InsertPhoto() публичный Метод

Insert the photo object into storage.
public InsertPhoto ( PhotoContract photo, int goldIncrement ) : Task
photo PhotoSharingApp.Portable.DataContracts.PhotoContract Photo Object.
goldIncrement int Gold to award for new photo.
Результат Task

InsertReport() публичный Метод

Inserts a report into Report table.
public InsertReport ( ReportContract report, string userRegistrationReference ) : Task
report PhotoSharingApp.Portable.DataContracts.ReportContract The report being inserted.
userRegistrationReference string Azure Mobile Service user id who is reporting it.
Результат Task

ReinitializeDatabase() публичный Метод

Forces a reinitalization of the database, deleting any existing data.
public ReinitializeDatabase ( string serverPath ) : System.Threading.Tasks.Task
serverPath string
Результат System.Threading.Tasks.Task

UpdatePhoto() публичный Метод

Updates an existing photo object's category and description fields.
public UpdatePhoto ( PhotoContract photoContract ) : Task
photoContract PhotoSharingApp.Portable.DataContracts.PhotoContract Photo object.
Результат Task

UpdatePhotoStatus() публичный Метод

Updates the status of the stored photo.
public UpdatePhotoStatus ( PhotoContract photoContract ) : Task
photoContract PhotoSharingApp.Portable.DataContracts.PhotoContract Photo object.
Результат Task

UpdateUser() публичный Метод

Updates the user profile picture. User gold balance is also updated if it is the first time the user is updating their profile picture.
public UpdateUser ( UserContract user ) : Task
user PhotoSharingApp.Portable.DataContracts.UserContract We need the whole user object as it is assumed the client will have given the photoId and url.
Результат Task