lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] NightOwl888 edited a comment on issue #282: Docs - Build/Deploy Automation
Date Thu, 28 May 2020 17:34:06 GMT

NightOwl888 edited a comment on issue #282:
URL: https://github.com/apache/lucenenet/issues/282#issuecomment-635477815


   > I guess there's a lot of ways to do things so would need a concrete example of what
you 'want' to do .
   
   The example that was followed to extend both codecs and "system properties" is outlined
in [DI-Friendly Framework](https://blog.ploeh.dk/2014/05/19/di-friendly-framework/). The concept
is rather abstract, and I was hoping to provide some specific examples that pertain only to
codecs (in particular for ASP.NET Core and in console applications).
   
   Microsoft has a [Dependency Injection in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1)
that gives a high-level overview. However, when searching for a similar document for console
applications, there are only examples such as [this one by a 3rd party](https://andrewlock.net/using-dependency-injection-in-a-net-core-console-application/).
   
   Effectively, what I am hoping for is
   
   - A general overview of abstract types of codecs (like what [already exists](https://lucenenet.apache.org/docs/4.8.0-beta00007/api/Lucene.Net.TestFramework/Lucene.Net.Codecs.html))
*
   - A how-to on creating a custom codec * ([example](https://dzone.com/articles/build-your-own-lucene-codec))
   - A how-to for testing a custom codec using the test framework * ([example](https://github.com/apache/lucenenet/blob/4ef61cba234ab87f9751c07f278a833d311d2c7a/src/Lucene.Net.Tests.TestFramework.DependencyInjection/Startup.cs))
   - A how-to for manual registration of custom codecs when not using DI *
   - A how-to for DI registration of codecs with ASP.NET Core *
   - A how-to for DI registration of codecs with a console application using Microsoft.Extensions.DependencyInjection
   - A how-to for DI registration of codecs using a 3rd party DI framework
   
   I think the ones with the asterisk are the most important.
   
   Ideally, they would be separate documents that are referenced in other relevant places.
For example, there should eventually be a document that explains how to configure the test
framework with DI in general, which would link over to the how-to on testing a codec.
   
   I am also kicking around the idea of making extension methods for `Microsoft.Extensions.DependencyInjection`
to make registration of common Lucene.NET services seamless (which of course would simplify
the configuration and the docs). For example:
   
   ```c#
   public void ConfigureServices(IServiceCollection services)
   {
       services.AddRazorPages();
       services.AddDefaultLuceneCodecs(); // Register Lucene.NET Codecs with DI in one line
   
       services.AddScoped<IMyDependency, MyDependency>();
       services.AddTransient<IOperationTransient, Operation>();
   }
   ```
   
   One issue with doing so is whether we should take a dependency on `Micorsoft.Extensions.DependencyInjection.Abstractions`
to build the functionality into our existing assemblies, or create additional integration
assemblies (and there would need to be several of them). The cost of taking on a non-invasive
dependency to make it "just work" with Microsoft apps seems low compared to creating several
packages for the sake of integration, so I am leaning toward that approach, especially since
we have already taken a dependency on `Microsoft.Extensions.Configuration.Abstractions` for
a similar reason.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message