Skip to content

Commit

Permalink
Added support for Async resource resolving.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoutkramer committed Dec 1, 2023
1 parent 463d6aa commit 3836d30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 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
4 changes: 2 additions & 2 deletions src/firely-net-sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<!-- Solution-wide properties for NuGet packaging -->
<PropertyGroup>
<VersionPrefix>5.4.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionPrefix>5.4.2</VersionPrefix>
<VersionSuffix>alpha3</VersionSuffix>
<Authors>Firely ([email protected]) and contributors</Authors>
<Company>Firely (https://fire.ly)</Company>
<Copyright>Copyright 2013-2023 Firely. Contains materials (C) HL7 International</Copyright>
Expand Down

0 comments on commit 3836d30

Please sign in to comment.