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

Add IAsyncResourceResolver support to SnapshotSource #2635

Merged
Merged
Changes from all commits
Commits
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
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