Skip to content

Instantly share code, notes, and snippets.

@EricAtMSFT
Last active March 14, 2016 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricAtMSFT/9ab38451139d177c37d4 to your computer and use it in GitHub Desktop.
Save EricAtMSFT/9ab38451139d177c37d4 to your computer and use it in GitHub Desktop.
// Stored Procedures
private const string TransferGoldStoredProcedureScriptFileName = @"Models\DocumentDB\js\transferGoldStoredProcedure.js";
private const string TransferGoldStoredProcedureId = "transferGold";
private const string GetRecentPhotosForCategoriesStoredProcedureScriptFileName = @"Models\DocumentDB\js\getRecentPhotosForCategoriesStoredProcedure.js";
private const string GetRecentPhotosForCategoriesStoredProcedureId = "getRecentPhotosForCategories";
private async Task InitializeStoredProceduresInDocumentDb()
{
// Initialize GoldTransaction Sproc
var sproc = new StoredProcedure
{
Id = TransferGoldStoredProcedureId,
Body = File.ReadAllText(TransferGoldStoredProcedureScriptFileName)
};
await _documentClient.UpsertStoredProcedureAsync(DocumentCollectionUri, sproc);
// Initialize GetCategoriesPreview Sproc
sproc = new StoredProcedure
{
Id = GetRecentPhotosForCategoriesStoredProcedureId,
Body = File.ReadAllText(GetRecentPhotosForCategoriesStoredProcedureScriptFileName)
};
await _documentClient.UpsertStoredProcedureAsync(DocumentCollectionUri, sproc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment