[ 
https://issues.apache.org/jira/browse/LUCENENET-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104769#comment-16104769
 ] 

ASF GitHub Bot commented on LUCENENET-565:
------------------------------------------

Github user jeme commented on the issue:

    https://github.com/apache/lucenenet/pull/209
  
    So for the past week I have been trying to make a "prototype" project that 
integrates this... all in all working with AspNetCore it self actually posed 
far more trouble than integrating the replicator into it as an afterthought... 
(Which I think is what will happen in many cases)...
    
    It does have some gotchas and I am considering some changes in the 
HttpReplicator and HttpClientBase as a consequence... Even though the 
ReplicatorService it self was super easy to integrate, there is things I am 
reconsidering about it... 
    
    Here is an example of it integrated into a "Mvc"Controller:
    
    ```csharp
        [Route("api/[controller]")]
        public class ReplicateController : Controller
        {
            [HttpGet("{*path}")]
            public void Get(string path) => 
Index.Instance.Service.Perform(Request, Response);
        }
    ```
    
    This requires the replicator to be created as:
    ```csharp
        replicator = new LocalReplicator();
        Service = new ReplicationService(new Dictionary<string, IReplicator>()
        {
            .... indexes
        }, "/api/replicate");
    ```
    
    Most notable is the `[Route("api/[controller]")]` + the controller type 
that has to be in sync with whats provided in the ReplicationService ctor: 
`"/api/replicate"` (replicate because we named the controller 
ReplicateController.
    
    > I would expect there to be an extension method for IHostingEnvironment or 
IApplicationBuilder so it could be added to the application:
    
    I don't think that would make all that much sense, there is allot more to 
it and I think it would be difficult, at least at this point to make the 
integration so simple as the "user" needs to manage publishing revisions etc. 
them self...
    
    But I also don't think "middleware" is the right place for this, instead it 
depends on the kind of solution your making, often I would think that you would 
have some sort of web-api along side of it, in this case it should go into a 
controller, much like above however it DOES feel a bit awkward that we have a 
Get method that is void and doesn't have any parameters at all.
    
    However I do think it fair to provide the signature currently given by the 
`Lucene.Net.Replicator.AspNetCore` as a basic approach as that is very similar 
to the Java version, which means it feels familiar and people will be able to 
read Java examples and somewhat translate them to .NET.
    
    However I would like to supplement this with something that felt more 
natural, but it requires allot more thought, something that might be easier 
with a "working" solution in front of me, which I have now... But it would 
still take time.
    
    So short term brings me back to that there are some minor reconsideration I 
wan't to take on the HttpReplicator and HttpClientBase as well as the 
ReplicatorService and the abstraction.



> Port Lucene.Net.Replicator
> --------------------------
>
>                 Key: LUCENENET-565
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-565
>             Project: Lucene.Net
>          Issue Type: Task
>          Components: Lucene.Net.Replicator
>    Affects Versions: Lucene.Net 4.8.0
>            Reporter: Shad Storhaug
>            Priority: Minor
>              Labels: features
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to