lucenenet icon indicating copy to clipboard operation
lucenenet copied to clipboard

Task: Review Lucene.Net.Replicator.AspNetCore and add to the NuGet release

Open NightOwl888 opened this issue 1 year ago • 0 comments

When Lucene.Net.Replicator was ported in #209, we were considering options on how to integrate it into various .NET technologies so it would work across both .NET Framework and .NET Core. Unfortunately, unlike Java, .NET has no such thing as a "Servlet" that is a piece that can be plugged into any network technology, so this was a bit of a struggle.

Since that time

  1. ASP.NET Core has become much more mainstream
  2. The Lucene.Net.Tests.Replicator tests have been debugged and Lucene.Net.Replicator is now deemed more stable
  3. A new approach was explored into how to use Replicator as middleware in .NET 5+

Back then, we also opted not to release Lucene.Net.Replicator.AspNetCore, but leave it as more of a demo until we had a chance to fully explore and document how to configure it.

Tasks to Complete

  • [ ] Allow both HTTP and HTTPS to be configured as a protocol (I noticed the scan picked up that we have it hard-coded to HTTP in some places).
  • [ ] Build extension methods to extend Microsoft.Extensions.DependencyInjection.Abstractions to configure Lucene.Net.Replicator for use in any AspNetCore app (middleware where it is allowed) - example extension method - example configuration.
  • [ ] Add documentation on how to use the new extension methods to configure the replication server.
  • [ ] Install Lucene.Net.Replicator.AspNetCore and set it up for use in a demo project and look for any usability issues to address.
  • [ ] Add tests for Lucene.Net.Replicator.AspNetCore (note that it is used by Lucene.Net.Tests.Replicator to test functionality, we just want some basic tests to ensure the extension methods function)
  • [ ] Enable Lucene.Net.Replicator.AspNetCore to be packed to NuGet.

To build the extension methods, we should be analyzing the source of other various AspNetCore services and closely following the design patterns used by Microsoft. These methods follow a builder pattern where they can be chained together as fluent configuration methods.

Note that we use a different configuration setup prior to .NET 5 where routing configuration was changed to map routes to middleware, so we may need to have different extension methods depending on which target framework the user has installed. We may need to consider targeting net5.0 directly and/or adding another project Lucene.Net.Replicator.AspNetCore.Extensions to make the net5.0+ requirement work right for setting up middleware.

NightOwl888 avatar Nov 07 '22 03:11 NightOwl888