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

Remove extra scope while getting IMessageInspector2. #1089

Merged
Merged
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
10 changes: 2 additions & 8 deletions src/SoapCore/SoapEndpointMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
using SoapCore.Meta;
using SoapCore.Serializer;
using SoapCore.ServiceModel;
using System;

Check warning on line 16 in src/SoapCore/SoapEndpointMiddleware.cs

View workflow job for this annotation

GitHub Actions / Analyze

Using directive for 'System' should appear before directive for 'SoapCore.ServiceModel' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.Collections.Generic;

Check warning on line 17 in src/SoapCore/SoapEndpointMiddleware.cs

View workflow job for this annotation

GitHub Actions / Analyze

Using directive for 'System.Collections.Generic' should appear before directive for 'SoapCore.ServiceModel' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.Diagnostics;

Check warning on line 18 in src/SoapCore/SoapEndpointMiddleware.cs

View workflow job for this annotation

GitHub Actions / Analyze

Using directive for 'System.Diagnostics' should appear before directive for 'SoapCore.ServiceModel' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.IO;

Check warning on line 19 in src/SoapCore/SoapEndpointMiddleware.cs

View workflow job for this annotation

GitHub Actions / Analyze

Using directive for 'System.IO' should appear before directive for 'SoapCore.ServiceModel' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.Linq;

Check warning on line 20 in src/SoapCore/SoapEndpointMiddleware.cs

View workflow job for this annotation

GitHub Actions / Analyze

Using directive for 'System.Linq' should appear before directive for 'SoapCore.ServiceModel' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md)
using System.Net;
using System.Net.Http.Headers;
using System.Reflection;
Expand Down Expand Up @@ -495,16 +495,10 @@
throw new ArgumentException($"Unable to handle request without a valid action parameter. Please supply a valid soap action.");
}

var messageInspector2s = serviceProvider.GetServices<IMessageInspector2>();
var correlationObjects2 = default(List<(IMessageInspector2 inspector, object correlationObject)>);

//Not sure that this extra scope is needed...
using (IServiceScope scope = serviceProvider.CreateScope())
{
var messageInspector2s = scope.ServiceProvider.GetServices<IMessageInspector2>();
correlationObjects2 = messageInspector2s.Select(mi =>
(inspector: mi, correlationObject: mi.AfterReceiveRequest(ref requestMessage, _service)))
.ToList();
}
correlationObjects2 = messageInspector2s.Select(mi => (inspector: mi, correlationObject: mi.AfterReceiveRequest(ref requestMessage, _service))).ToList();

// for getting soapaction and parameters in (optional) body
// GetReaderAtBodyContents must not be called twice in one request
Expand Down
Loading