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

is now async hostbuilder #4

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions OpenFTTH.RelationalProjector/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Microsoft.Extensions.Hosting;
using System.Threading.Tasks;

namespace OpenFTTH.RelationalProjector
{
class Program
{
static void Main(string[] args)
static async Task Main(string[] args)
{
Startup.CreateHostBuilder(args).Build().Run();
await Startup.CreateHostBuilder(args).Build().RunAsync();
}
}
}
10 changes: 3 additions & 7 deletions OpenFTTH.RelationalProjector/RelationalDatabaseProjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public RelationalDatabaseProjection(ILogger<RelationalDatabaseProjection> logger
{
_logger = logger;
_dbWriter = dbWriter;

ProjectEvent<WalkOfInterestRegistered>(Project);
ProjectEvent<WalkOfInterestRouteNetworkElementsModified>(Project);
ProjectEvent<InterestUnregistered>(Project);
Expand Down Expand Up @@ -104,7 +104,7 @@ private void Handle(WalkOfInterestRegistered @event)
_dbWriter.InsertGuidsIntoRouteElementToInterestTable(_schemaName, @event.Interest.Id, RemoveDublicatedIds(@event.Interest.RouteNetworkElementRefs));
}
}


private void Handle(WalkOfInterestRouteNetworkElementsModified @event)
{
Expand All @@ -124,7 +124,7 @@ private void Handle(InterestUnregistered @event)
if (_bulkMode)
{
if (_interestToRouteElementRel.ContainsKey(@event.InterestId))
_interestToRouteElementRel.Remove(@event.InterestId);
_interestToRouteElementRel.Remove(@event.InterestId);
}
else
{
Expand Down Expand Up @@ -178,7 +178,6 @@ private void Handle(SpanEquipmentSpecificationChanged @event)
var diameter = _spanStructureSpecificationById[_spanEquipmentSpecificationById[@event.NewSpecificationId].RootTemplate.SpanStructureSpecificationId].OuterDiameter;

_dbWriter.UpdateSpanEquipmentDiameterInConduitTable(_schemaName, @event.SpanEquipmentId, diameter.Value);

}
}

Expand Down Expand Up @@ -206,11 +205,8 @@ public override void DehydrationFinish()
_bulkMode = false;

_logger.LogInformation("Bulk write finish.");


}


private IEnumerable<Guid> RemoveDublicatedIds(RouteNetworkElementIdList routeNetworkElementRefs)
{
RouteNetworkElementIdList result = new();
Expand Down