Skip to content

Commit 6330106

Browse files
Ihar YakimushIhar Yakimush
authored andcommitted
adjust namespaces
1 parent 772f4bb commit 6330106

31 files changed

+59
-90
lines changed

Community.AspNetCore.ExceptionHandling.Integration/Controllers/ValuesController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Data;
4-
using System.Linq;
5-
using System.Threading.Tasks;
64
using Microsoft.AspNetCore.Mvc;
75

8-
namespace Commmunity.AspNetCore.ExceptionHandling.Integration.Controllers
6+
namespace Community.AspNetCore.ExceptionHandling.Integration.Controllers
97
{
108
[Route("api/[controller]")]
119
public class ValuesController : Controller

Community.AspNetCore.ExceptionHandling.Integration/Program.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore;
1+
using Microsoft.AspNetCore;
72
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.Extensions.Configuration;
9-
using Microsoft.Extensions.Logging;
103

11-
namespace Commmunity.AspNetCore.ExceptionHandling.Integration
4+
namespace Community.AspNetCore.ExceptionHandling.Integration
125
{
136
public class Program
147
{

Community.AspNetCore.ExceptionHandling.Integration/Startup.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Data;
4-
using System.IO;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
8-
using Commmunity.AspNetCore.ExceptionHandling.Mvc;
93
using Microsoft.AspNetCore.Builder;
104
using Microsoft.AspNetCore.Hosting;
115
using Microsoft.Extensions.Configuration;
126
using Microsoft.Extensions.DependencyInjection;
13-
using Microsoft.Extensions.Logging;
14-
using Microsoft.Extensions.Options;
157

16-
namespace Commmunity.AspNetCore.ExceptionHandling.Integration
8+
namespace Community.AspNetCore.ExceptionHandling.Integration
179
{
1810
public class Startup
1911
{

Community.AspNetCore.ExceptionHandling.Mvc/PolicyBuilderExtensions.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using System;
2-
using Commmunity.AspNetCore.ExceptionHandling.Builder;
32
using Microsoft.AspNetCore.Http;
43
using Microsoft.AspNetCore.Mvc;
54
using Microsoft.AspNetCore.Mvc.Abstractions;
65
using Microsoft.AspNetCore.Mvc.Infrastructure;
76
using Microsoft.AspNetCore.Routing;
87
using Microsoft.Extensions.DependencyInjection;
98

10-
namespace Commmunity.AspNetCore.ExceptionHandling.Mvc
9+
namespace Community.AspNetCore.ExceptionHandling.Mvc
1110
{
1211
public static class PolicyBuilderExtensions
1312
{
@@ -44,14 +43,14 @@ public static IResponseHandlers<TException> WithActionResult<TException, TResult
4443
return builder.WithBody((request, streamWriter, exception) =>
4544
{
4645
var context = request.HttpContext;
47-
var executor = context.RequestServices.GetService<IActionResultExecutor<TResult>>();
46+
var executor = ServiceProviderServiceExtensions.GetService<IActionResultExecutor<TResult>>(context.RequestServices);
4847

4948
if (executor == null)
5049
{
5150
throw new InvalidOperationException($"No result executor for '{typeof(TResult).FullName}' has been registered.");
5251
}
5352

54-
var routeData = context.GetRouteData() ?? EmptyRouteData;
53+
var routeData = RoutingHttpContextExtensions.GetRouteData(context) ?? EmptyRouteData;
5554

5655
var actionContext = new ActionContext(context, routeData, EmptyActionDescriptor);
5756

@@ -85,7 +84,7 @@ public static IResponseHandlers<TException> WithActionResult<TException, TResult
8584
where TException : Exception
8685
where TResult : IActionResult
8786
{
88-
return builder.WithActionResult((request, exception) => result);
87+
return WithActionResult<TException, TResult>(builder, (request, exception) => result);
8988
}
9089

9190
/// <summary>
@@ -113,7 +112,7 @@ public static IResponseHandlers<TException> WithObjectResult<TException, TObject
113112
this IResponseHandlers<TException> builder, TObject value, int index = -1)
114113
where TException : Exception
115114
{
116-
return builder.WithActionResult(new ObjectResult(value), index);
115+
return WithActionResult<TException, ObjectResult>(builder, new ObjectResult(value), index);
117116
}
118117

119118
/// <summary>
@@ -141,8 +140,7 @@ public static IResponseHandlers<TException> WithObjectResult<TException, TObject
141140
this IResponseHandlers<TException> builder, Func<HttpRequest, TException, TObject> valueFactory, int index = -1)
142141
where TException : Exception
143142
{
144-
return builder.WithActionResult(
145-
(request, exception) => new ObjectResult(valueFactory(request, exception)), index);
143+
return WithActionResult<TException, ObjectResult>(builder, (request, exception) => new ObjectResult(valueFactory(request, exception)), index);
146144
}
147145
}
148146
}

Community.AspNetCore.ExceptionHandling.NewtonsoftJson/PolicyBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using System;
22
using System.IO;
33
using System.Threading.Tasks;
4-
using Commmunity.AspNetCore.ExceptionHandling.Builder;
4+
using Community.AspNetCore.ExceptionHandling.Builder;
55
using Microsoft.AspNetCore.Http;
66
using Microsoft.Extensions.DependencyInjection;
77
using Microsoft.Net.Http.Headers;
88
using Newtonsoft.Json;
99

10-
namespace Commmunity.AspNetCore.ExceptionHandling.NewtonsoftJson
10+
namespace Community.AspNetCore.ExceptionHandling.NewtonsoftJson
1111
{
1212
public static class PolicyBuilderExtensions
1313
{

Community.AspNetCore.ExceptionHandling/AppBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using System;
2-
using Commmunity.AspNetCore.ExceptionHandling.Builder;
2+
using Community.AspNetCore.ExceptionHandling.Builder;
33
using Microsoft.AspNetCore.Builder;
44
using Microsoft.Extensions.DependencyInjection;
55
using Microsoft.Extensions.DependencyInjection.Extensions;
66
using Microsoft.Extensions.Options;
77

8-
namespace Commmunity.AspNetCore.ExceptionHandling
8+
namespace Community.AspNetCore.ExceptionHandling
99
{
1010
//TODO: add warning for policy override
1111
//TODO: add response handler

Community.AspNetCore.ExceptionHandling/Builder/ExceptionMapping.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
namespace Commmunity.AspNetCore.ExceptionHandling.Builder
2-
{
3-
using System;
4-
using Microsoft.Extensions.DependencyInjection;
1+
using System;
2+
using Microsoft.Extensions.DependencyInjection;
53

4+
namespace Community.AspNetCore.ExceptionHandling.Builder
5+
{
66
public class ExceptionMapping<TException> : IExceptionPolicyBuilder, IExceptionMapping<TException>, IResponseHandlers<TException>
77
where TException : Exception
88
{

Community.AspNetCore.ExceptionHandling/Builder/IExceptionMapping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace Commmunity.AspNetCore.ExceptionHandling.Builder
3+
namespace Community.AspNetCore.ExceptionHandling.Builder
44
{
55
public interface IExceptionMapping<TException> : IExceptionPolicyBuilder
66
where TException : Exception

Community.AspNetCore.ExceptionHandling/Builder/PolicyBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Collections.Generic;
44
using Microsoft.Extensions.DependencyInjection;
55

6-
namespace Commmunity.AspNetCore.ExceptionHandling.Builder
6+
namespace Community.AspNetCore.ExceptionHandling.Builder
77
{
88
public class PolicyBuilder : IExceptionPolicyBuilder, IServiceCollection
99
{

Community.AspNetCore.ExceptionHandling/Const.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Commmunity.AspNetCore.ExceptionHandling
1+
namespace Community.AspNetCore.ExceptionHandling
22
{
33
public static class Const
44
{

0 commit comments

Comments
 (0)