Skip to content

Commit

Permalink
Use [dynamic] to read the results from the Quwery event stream
Browse files Browse the repository at this point in the history
  • Loading branch information
MerrionComputing committed Mar 9, 2019
1 parent 3e1393c commit 36c9441
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ private static async Task<Get_League_Summary_Definition_Return > GetLeagueSumma

if (qryProjectionState.ProcessedRequests[0].ProjectionTypeName == typeof(Leagues.League.projection.League_Summary_Information).Name)
{
Leagues.League.projection.League_Summary_Information projectionResult = ((Newtonsoft.Json.Linq.JObject)qryProjectionState.ProcessedRequests[0].ReturnedValue).ToObject<Leagues.League.projection.League_Summary_Information>();
if (null != projectionResult)
dynamic projectionResult = (qryProjectionState.ProcessedRequests[0].ReturnedValue);
if (null != projectionResult )
{
ret.Location = projectionResult.Location;
ret.Date_Incorporated = projectionResult.Date_Incorporated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ private static async Task<ActivityResponse> OutputResultsGetLeagueSummaryQuery(
Get_League_Summary_Definition_Return projectionReturn = new Get_League_Summary_Definition_Return(queryGuid,
qryProjectionState.ProcessedRequests[0].AggregateInstanceKey);

Leagues.League.projection.League_Summary_Information projectionResult = null;

if (qryProjectionState.ProcessedRequests[0].ProjectionTypeName == typeof(Leagues.League.projection.League_Summary_Information).Name)
{
projectionResult = ((Newtonsoft.Json.Linq.JObject)qryProjectionState.ProcessedRequests[0].ReturnedValue).ToObject<Leagues.League.projection.League_Summary_Information>();
dynamic projectionResult = (qryProjectionState.ProcessedRequests[0].ReturnedValue);
if (null != projectionResult)
{
projectionReturn.Location = projectionResult.Location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="nunit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ public IEnumerable<string> EventGridTargets
}
}

/// <summary>
/// The subset of outputs for executing as SignalR targets
/// </summary>
public IEnumerable<string> SignalRTargets
{
get
{
if (null != targets)
{
return targets.Where(f => f.Value == QueryLogRecord.QueryReturnTarget.SignalR ).Select(f => f.Key).AsEnumerable();
}
return Enumerable.Empty<string>();
}
}

/// <summary>
/// The subset of outputs for executing as durable function orchestration triggers
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion TheLongRun.Common/QueryLogRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ public enum QueryReturnTarget
/// </summary>
ServiceBus = 4,
/// <summary>
/// Send the answer out by a SignalR message
/// </summary>
SignalR = 5,
/// <summary>
/// Raise an event to notify a durable function orchestration that has been paused waiting for
/// this query to complete that it is now good to go
/// </summary>
DurableFunctionOrchestration = 5
DurableFunctionOrchestration = 6
}

/// <summary>
Expand Down

0 comments on commit 36c9441

Please sign in to comment.