Skip to content

Commit

Permalink
Merge pull request #2635 from FirelyTeam/feature/1698-snapshotsource-…
Browse files Browse the repository at this point in the history
…asyncresolver

Add IAsyncResourceResolver support to SnapshotSource
  • Loading branch information
marcovisserFurore authored Dec 6, 2023
2 parents 19b86b4 + 41c7d57 commit b707cdf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Hl7.Fhir.Conformance/Specification/Source/SnapshotSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Hl7.Fhir.Utility;
using System;
using System.Diagnostics;
using T=System.Threading.Tasks;
using T = System.Threading.Tasks;

namespace Hl7.Fhir.Specification.Source
{
Expand Down Expand Up @@ -34,7 +34,9 @@ public SnapshotSource(SnapshotGenerator generator)
/// <summary>Creates a new instance of the <see cref="SnapshotSource"/> for the specified internal resolver.</summary>
/// <param name="source">An internal <see cref="IResourceResolver"/> instance. The implementation should be idempotent (i.e. cached), so the generated snapshots are persisted in memory.</param>
/// <param name="settings">Configuration settings for the snapshot generator.</param>
public SnapshotSource(IResourceResolver source, SnapshotGeneratorSettings settings)
#pragma warning disable CS0618 // Type or member is obsolete
public SnapshotSource(ISyncOrAsyncResourceResolver source, SnapshotGeneratorSettings settings)
#pragma warning restore CS0618 // Type or member is obsolete
{
// SnapshotGenerator ctor will throw if source or settings are null
Generator = new SnapshotGenerator(source, settings);
Expand All @@ -43,11 +45,13 @@ public SnapshotSource(IResourceResolver source, SnapshotGeneratorSettings settin
/// <summary>Creates a new instance of the <see cref="SnapshotSource"/> for the specified internal resolver.</summary>
/// <param name="source">An internal <see cref="IResourceResolver"/> instance. The implementation should be idempotent (i.e. cached), so the generated snapshots are persisted in memory.</param>
/// <param name="regenerate">Determines if the source should always discard any existing snapshot components provided by the internal source and force re-generation.</param>
public SnapshotSource(IResourceResolver source, bool regenerate)
#pragma warning disable CS0618 // Type or member is obsolete
public SnapshotSource(ISyncOrAsyncResourceResolver source, bool regenerate)
#pragma warning restore CS0618 // Type or member is obsolete
: this(source, createSettings(regenerate)) { }

// Create default SnapshotGeneratorSettings, apply the specified regenerate flag
static SnapshotGeneratorSettings createSettings(bool regenerate)
private static SnapshotGeneratorSettings createSettings(bool regenerate)
{
var settings = SnapshotGeneratorSettings.CreateDefault();
settings.ForceRegenerateSnapshots = regenerate;
Expand All @@ -56,7 +60,9 @@ static SnapshotGeneratorSettings createSettings(bool regenerate)

/// <summary>Creates a new instance of the <see cref="SnapshotSource"/> for the specified internal resolver.</summary>
/// <param name="source">An internal <see cref="IResourceResolver"/> instance. The implementation should be idempotent (i.e. cached), so the generated snapshots are persisted in memory.</param>
public SnapshotSource(IResourceResolver source)
#pragma warning disable CS0618 // Type or member is obsolete
public SnapshotSource(ISyncOrAsyncResourceResolver source)
#pragma warning restore CS0618 // Type or member is obsolete
: this(source, SnapshotGeneratorSettings.CreateDefault()) { }

/// <summary>Returns the internal <see cref="SnapshotGenerator"/> instance used by the source.</summary>
Expand Down

0 comments on commit b707cdf

Please sign in to comment.