Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmos DB initialization logic to a new assembly #3743

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c25fb31
a)Changes done on existing Microsoft.Health.Fhir.CosmosDb Project
mahajan-xor Mar 8, 2024
223dc0e
versions updated for some packages
mahajan-xor Mar 11, 2024
ebd2c59
Merge remote-tracking branch 'origin/main' into personal/anilm/fhir-c…
mahajan-xor Mar 11, 2024
c33ac2e
Moved to CosmosDB.Core
mahajan-xor Mar 15, 2024
c12e3e9
1. Added ICollectionDataUpdater interface in cosmosdb project
mahajan-xor Mar 20, 2024
a8b3575
Merge remote-tracking branch 'origin/main' into personal/anilm/fhir-c…
mahajan-xor Mar 20, 2024
b296c6b
worked on code review comments
mahajan-xor Mar 22, 2024
d4b9649
worked on review comments and cleaned up code
mahajan-xor Mar 27, 2024
84f73a2
Merge remote-tracking branch 'origin/main' into personal/anilm/fhir-c…
mahajan-xor Mar 27, 2024
f875929
done with end to end flow testing with CosmosDbFhirStorageTestsFixtur…
mahajan-xor Apr 4, 2024
012e288
resolved installed storeprocedure issue
mahajan-xor Apr 5, 2024
b6fd34f
Unit test cases updated . DataPlaneCosmosDbRegistarionExtensions issu…
mahajan-xor Apr 12, 2024
c370e04
main branch merged also modified harddelete file
mahajan-xor Apr 12, 2024
25cd8c7
resolved build issue for hardDelete
mahajan-xor Apr 12, 2024
ca6ddfa
identity package updated to latest version to solve vulnerability issue
mahajan-xor Apr 17, 2024
780183a
Solve the test failures in PR
mahajan-xor Apr 26, 2024
4dff5f0
merged with main branch
mahajan-xor Apr 26, 2024
604122c
Merge remote-tracking branch 'origin/main' into personal/anilm/fhir-c…
mahajan-xor Apr 28, 2024
15a047d
fixed review comments
mahajan-xor Apr 29, 2024
642310e
solved issues with unit test
mahajan-xor Apr 30, 2024
1b6dd10
Merge remote-tracking branch 'origin/main' into personal/anilm/fhir-c…
mahajan-xor May 2, 2024
7698d56
Added new project refrences to docker file
mahajan-xor May 3, 2024
e6aa261
updated docker file
mahajan-xor May 3, 2024
814c32b
removed extra call to fhircollectionsetting updater
mahajan-xor May 10, 2024
1d53f73
Refactoring to avoid circle dependency (#3877)
fhibf May 29, 2024
12e3c30
merging refatoring changes with local branch
mahajan-xor May 29, 2024
5f981cc
solved merge issues
mahajan-xor May 29, 2024
c962a1f
merged main branch changes
mahajan-xor May 29, 2024
9269d50
fixes namespace issue for Core.Resources
mahajan-xor May 29, 2024
fd6169e
resolves unit test issue for FHIRCosmosClientInitializer
mahajan-xor May 30, 2024
0041094
Resolves unite test issues
mahajan-xor Jun 5, 2024
2c6a756
merge with main
mahajan-xor Jun 5, 2024
6f8bf1c
added missing decorators on DataPlaneCollectionSetupTests
mahajan-xor Jun 5, 2024
810cb16
work on review comments
mahajan-xor Jun 6, 2024
8a95303
Adds classification attibutes
mahajan-xor Jun 17, 2024
7a7650b
Merge remote-tracking branch 'origin/main' into personal/anilm/fhir-c…
mahajan-xor Jul 2, 2024
b15ee62
-Adding newly added project references to R4.slnf and R5.slnf
mahajan-xor Jul 2, 2024
4cff2cf
refactoring CreateCosmosClient logic to have validation logic
mahajan-xor Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion Microsoft.Health.Fhir.sln
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTester", "tools\PerfTes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlScriptRunner", "tools\SqlScriptRunner\SqlScriptRunner.csproj", "{76C29222-8D35-43A2-89C5-43114D113C10}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Health.Fhir.CosmosDb.Initialization", "src\Microsoft.Health.Fhir.CosmosDb.Initialization\Microsoft.Health.Fhir.CosmosDb.Initialization.csproj", "{10661BC9-01B0-4E35-9751-3B5CE97E25C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests", "src\Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests\Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests.csproj", "{B9AAA11D-8C8C-44C3-AADE-801376EF82F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Health.Fhir.CosmosDb.Core", "src\Microsoft.Health.Fhir.CosmosDb.Core\Microsoft.Health.Fhir.CosmosDb.Core.csproj", "{1CD46DC5-6022-4BBE-9A1C-6B13C3CEFC75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -465,6 +471,18 @@ Global
{76C29222-8D35-43A2-89C5-43114D113C10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76C29222-8D35-43A2-89C5-43114D113C10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76C29222-8D35-43A2-89C5-43114D113C10}.Release|Any CPU.Build.0 = Release|Any CPU
{10661BC9-01B0-4E35-9751-3B5CE97E25C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10661BC9-01B0-4E35-9751-3B5CE97E25C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10661BC9-01B0-4E35-9751-3B5CE97E25C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10661BC9-01B0-4E35-9751-3B5CE97E25C0}.Release|Any CPU.Build.0 = Release|Any CPU
{B9AAA11D-8C8C-44C3-AADE-801376EF82F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9AAA11D-8C8C-44C3-AADE-801376EF82F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9AAA11D-8C8C-44C3-AADE-801376EF82F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9AAA11D-8C8C-44C3-AADE-801376EF82F0}.Release|Any CPU.Build.0 = Release|Any CPU
{1CD46DC5-6022-4BBE-9A1C-6B13C3CEFC75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CD46DC5-6022-4BBE-9A1C-6B13C3CEFC75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CD46DC5-6022-4BBE-9A1C-6B13C3CEFC75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CD46DC5-6022-4BBE-9A1C-6B13C3CEFC75}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -557,10 +575,13 @@ Global
{71A1A274-23A9-441B-BB47-1FC561FF0F35} = {B70945F4-01A6-4351-955B-C4A2943B5E3B}
{5E0B69FE-40DE-42E8-9F67-4BB7410AF67C} = {B70945F4-01A6-4351-955B-C4A2943B5E3B}
{76C29222-8D35-43A2-89C5-43114D113C10} = {B70945F4-01A6-4351-955B-C4A2943B5E3B}
{10661BC9-01B0-4E35-9751-3B5CE97E25C0} = {DC5A2CB1-8995-4D39-97FE-3CE80E892C69}
{B9AAA11D-8C8C-44C3-AADE-801376EF82F0} = {DC5A2CB1-8995-4D39-97FE-3CE80E892C69}
{1CD46DC5-6022-4BBE-9A1C-6B13C3CEFC75} = {DC5A2CB1-8995-4D39-97FE-3CE80E892C69}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E370FB31-CF95-47D1-B1E1-863A77973FF8}
RESX_SortFileContentOnSave = True
SolutionGuid = {E370FB31-CF95-47D1-B1E1-863A77973FF8}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
test\Microsoft.Health.Fhir.Shared.Tests.E2E.Common\Microsoft.Health.Fhir.Shared.Tests.E2E.Common.projitems*{0478b687-7105-40f6-a2dc-81057890e944}*SharedItemsImports = 13
Expand Down
3 changes: 3 additions & 0 deletions R4.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"src\\Microsoft.Health.Fhir.Azure\\Microsoft.Health.Fhir.Azure.csproj",
"src\\Microsoft.Health.Fhir.Core.UnitTests\\Microsoft.Health.Fhir.Core.UnitTests.csproj",
"src\\Microsoft.Health.Fhir.Core\\Microsoft.Health.Fhir.Core.csproj",
"src\Microsoft.Health.Fhir.CosmosDb.Core\Microsoft.Health.Fhir.CosmosDb.Core.csproj",
"src\Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests\Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests.csproj",
"src\Microsoft.Health.Fhir.CosmosDb.Initialization\Microsoft.Health.Fhir.CosmosDb.Initialization.csproj",
"src\\Microsoft.Health.Fhir.CosmosDb.UnitTests\\Microsoft.Health.Fhir.CosmosDb.UnitTests.csproj",
"src\\Microsoft.Health.Fhir.CosmosDb\\Microsoft.Health.Fhir.CosmosDb.csproj",
"src\\Microsoft.Health.Fhir.R4.Api\\Microsoft.Health.Fhir.R4.Api.csproj",
Expand Down
3 changes: 3 additions & 0 deletions R5.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"src\\Microsoft.Health.Fhir.Azure\\Microsoft.Health.Fhir.Azure.csproj",
"src\\Microsoft.Health.Fhir.Core.UnitTests\\Microsoft.Health.Fhir.Core.UnitTests.csproj",
"src\\Microsoft.Health.Fhir.Core\\Microsoft.Health.Fhir.Core.csproj",
"src\Microsoft.Health.Fhir.CosmosDb.Core\Microsoft.Health.Fhir.CosmosDb.Core.csproj",
"src\Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests\Microsoft.Health.Fhir.CosmosDb.Initialization.UnitTests.csproj",
"src\Microsoft.Health.Fhir.CosmosDb.Initialization\Microsoft.Health.Fhir.CosmosDb.Initialization.csproj",
"src\\Microsoft.Health.Fhir.CosmosDb.UnitTests\\Microsoft.Health.Fhir.CosmosDb.UnitTests.csproj",
"src\\Microsoft.Health.Fhir.CosmosDb\\Microsoft.Health.Fhir.CosmosDb.csproj",
"src\\Microsoft.Health.Fhir.R5.Api\\Microsoft.Health.Fhir.R5.Api.csproj",
Expand Down
6 changes: 6 additions & 0 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ COPY ./src/Microsoft.Health.Fhir.Api/Microsoft.Health.Fhir.Api.csproj \
COPY ./src/Microsoft.Health.Fhir.CosmosDb/Microsoft.Health.Fhir.CosmosDb.csproj \
./src/Microsoft.Health.Fhir.CosmosDb/Microsoft.Health.Fhir.CosmosDb.csproj

COPY ./src/Microsoft.Health.Fhir.CosmosDb.Core/Microsoft.Health.Fhir.CosmosDb.Core.csproj \
./src/Microsoft.Health.Fhir.CosmosDb.Core/Microsoft.Health.Fhir.CosmosDb.Core.csproj

COPY ./src/Microsoft.Health.Fhir.CosmosDb.Initialization/Microsoft.Health.Fhir.CosmosDb.Initialization.csproj \
./src/Microsoft.Health.Fhir.CosmosDb.Initialization/Microsoft.Health.Fhir.CosmosDb.Initialization.csproj

COPY ./src/Microsoft.Health.Fhir.${FHIR_VERSION}.Core/Microsoft.Health.Fhir.${FHIR_VERSION}.Core.csproj \
./src/Microsoft.Health.Fhir.${FHIR_VERSION}.Core/Microsoft.Health.Fhir.${FHIR_VERSION}.Core.csproj

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

namespace Microsoft.Health.Fhir.CosmosDb.Configs
namespace Microsoft.Health.Fhir.CosmosDb.Core.Configs
{
public class CosmosCollectionConfiguration
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Collections.Generic;
using Microsoft.Azure.Cosmos;

namespace Microsoft.Health.Fhir.CosmosDb.Configs
namespace Microsoft.Health.Fhir.CosmosDb.Core.Configs
{
public class CosmosDataStoreConfiguration
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using System;

namespace Microsoft.Health.Fhir.CosmosDb.Configs
namespace Microsoft.Health.Fhir.CosmosDb.Core.Configs
{
public class CosmosDataStoreParallelQueryOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

namespace Microsoft.Health.Fhir.CosmosDb.Configs
namespace Microsoft.Health.Fhir.CosmosDb.Core.Configs
{
public class CosmosDataStoreRetryOptions
{
Expand Down
13 changes: 13 additions & 0 deletions src/Microsoft.Health.Fhir.CosmosDb.Core/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

namespace Microsoft.Health.Fhir.CosmosDb.Core
{
public static class Constants
{
public const string CollectionConfigurationName = "fhirCosmosDb";
public const string RawResource = "rawResource";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public static class CosmosClientExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage.Versioning
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public interface ICollectionUpdater
public interface ICollectionDataUpdater
{
Task ExecuteAsync(Container container, CancellationToken cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
using Polly;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public interface ICollectionInitializer
{
Task<Container> InitializeCollectionAsync(CosmosClient client, CancellationToken cancellationToken = default);
Task<Container> InitializeCollectionAsync(CosmosClient client, AsyncPolicy retryPolicy, CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Polly;

namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public interface ICollectionSetup
{
public Task CreateDatabaseAsync(AsyncPolicy retryPolicy, CancellationToken cancellationToken);

public Task CreateCollectionAsync(IEnumerable<ICollectionInitializer> collectionInitializers, AsyncPolicy retryPolicy, CancellationToken cancellationToken = default);

public Task UpdateFhirCollectionSettingsAsync(CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
using Microsoft.Health.Fhir.CosmosDb.Configs;
using Microsoft.Health.Fhir.CosmosDb.Core.Configs;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
/// <summary>
/// Provides methods for creating a CosmosClient instance and initializing a collection.
Expand All @@ -32,16 +32,6 @@ public interface ICosmosClientInitializer
/// <param name="cosmosCollectionConfiguration">The collection configuration for the query to use</param>
Task OpenCosmosClient(CosmosClient client, CosmosDataStoreConfiguration configuration, CosmosCollectionConfiguration cosmosCollectionConfiguration);

/// <summary>
/// Ensures that the necessary database and collection exist with the proper indexing policy and stored procedures
/// </summary>
/// <param name="client">The <see cref="CosmosClient"/> instance to use for initialization.</param>
/// <param name="cosmosDataStoreConfiguration">The data store configuration.</param>
/// <param name="collectionInitializers">The collection of collection initializers.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>A task</returns>
Task InitializeDataStoreAsync(CosmosClient client, CosmosDataStoreConfiguration cosmosDataStoreConfiguration, IEnumerable<ICollectionInitializer> collectionInitializers, CancellationToken cancellationToken = default);

/// <summary>
/// Creates a new Container instance for access the Cosmos API
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
using Microsoft.Health.Fhir.CosmosDb.Configs;
using Microsoft.Health.Fhir.CosmosDb.Core.Configs;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public interface ICosmosClientTestProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public interface ICosmosDbDistributedLock : IAsyncDisposable, IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

using Microsoft.Azure.Cosmos;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public interface ICosmosDbDistributedLockFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage
{
public static class KnownDocumentProperties
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.Scripts;

namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage.StoredProcedures
{
public interface IStoredProcedure
{
Task<StoredProcedureExecuteResponse<T>> ExecuteStoredProcAsync<T>(Scripts client, string partitionId, CancellationToken cancellationToken, params object[] parameters);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;

namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage.StoredProcedures
{
public interface IStoredProcedureInstaller
{
Task ExecuteAsync(Container container, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

using Microsoft.Azure.Cosmos.Scripts;

namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage.StoredProcedures
namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage.StoredProcedures
{
public interface IStoredProcedure
public interface IStoredProcedureMetadata
{
string FullName { get; }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

using System;
using System.Threading;
using System.Threading.Tasks;
mahajan-xor marked this conversation as resolved.
Show resolved Hide resolved
using EnsureThat;
using Microsoft.Azure.Cosmos;
using Microsoft.Azure.Cosmos.Scripts;
using Microsoft.Health.Core.Extensions;

namespace Microsoft.Health.Fhir.CosmosDb.Core.Features.Storage.StoredProcedures
{
public abstract class StoredProcedureBase : IStoredProcedure
mahajan-xor marked this conversation as resolved.
Show resolved Hide resolved
{
private readonly IStoredProcedureMetadata _storedProcedureMetadata;

protected StoredProcedureBase(IStoredProcedureMetadata storedProcedureMetadata)
{
mahajan-xor marked this conversation as resolved.
Show resolved Hide resolved
EnsureArg.IsNotNull(storedProcedureMetadata, nameof(storedProcedureMetadata));

_storedProcedureMetadata = storedProcedureMetadata;
}

public string FullName => _storedProcedureMetadata.FullName;

public async Task<StoredProcedureExecuteResponse<T>> ExecuteStoredProcAsync<T>(Scripts client, string partitionId, CancellationToken cancellationToken, params object[] parameters)
{
EnsureArg.IsNotNull(client, nameof(client));
EnsureArg.IsNotNull(partitionId, nameof(partitionId));

StoredProcedureExecuteResponse<T> results = await client.ExecuteStoredProcedureAsync<T>(
FullName,
new PartitionKey(partitionId),
parameters,
cancellationToken: cancellationToken);

return results;
}
}
}
Loading
Loading