Skip to content

Commit 868f67a

Browse files
committed
fix IDE informations
1 parent 1908eab commit 868f67a

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

src/MicroBatchFramework.WebHosting/BatchEngineMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.AspNetCore.Http;
1+
using Microsoft.AspNetCore.Http;
22
using Microsoft.Extensions.Logging;
33
using System;
44
using System.Collections.Generic;
@@ -115,7 +115,7 @@ public async Task Invoke(HttpContext httpContext)
115115
}
116116

117117
// create args
118-
string[] args = null;
118+
string[] args;
119119
try
120120
{
121121
if (httpContext.Request.HasFormContentType)

src/MicroBatchFramework.WebHosting/BatchEngineSwaggerMiddleware.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ namespace MicroBatchFramework.WebHosting
99
{
1010
public class BatchEngineSwaggerMiddleware
1111
{
12-
private static readonly Task EmptyTask = Task.FromResult(0);
13-
1412
private readonly RequestDelegate next;
1513
private readonly MethodInfo[] handlers;
1614
private readonly SwaggerOptions options;

src/MicroBatchFramework.WebHosting/Swagger/SwaggerDefinitionBuilder.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using MicroBatchFramework.WebHosting.Swagger.Schemas;
1+
using MicroBatchFramework.WebHosting.Swagger.Schemas;
22
using Microsoft.AspNetCore.Http;
33
using Newtonsoft.Json;
44
using Newtonsoft.Json.Serialization;
@@ -44,13 +44,15 @@ public byte[] BuildSwaggerJson()
4444
: null;
4545
}
4646

47-
var doc = new SwaggerDocument();
48-
doc.info = options.Info;
49-
doc.host = (options.CustomHost != null) ? options.CustomHost(httpContext) : httpContext.Request.Headers["Host"][0];
50-
doc.basePath = options.ApiBasePath;
51-
doc.schemes = (options.ForceSchemas.Length == 0) ? new[] { httpContext.Request.IsHttps ? "https" : httpContext.Request.Scheme } : options.ForceSchemas;
52-
doc.paths = new Dictionary<string, PathItem>();
53-
doc.definitions = new Dictionary<string, Schema>();
47+
var doc = new SwaggerDocument
48+
{
49+
info = options.Info,
50+
host = (options.CustomHost != null) ? options.CustomHost(httpContext) : httpContext.Request.Headers["Host"][0],
51+
basePath = options.ApiBasePath,
52+
schemes = (options.ForceSchemas.Length == 0) ? new[] { httpContext.Request.IsHttps ? "https" : httpContext.Request.Scheme } : options.ForceSchemas,
53+
paths = new Dictionary<string, PathItem>(),
54+
definitions = new Dictionary<string, Schema>()
55+
};
5456

5557
// tags.
5658
var xmlServiceName = (xDocLookup != null)
@@ -203,8 +205,7 @@ string BuildSchema(IDictionary<string, Schema> definitions, Type type)
203205
var fullName = type.FullName;
204206
if (fullName == null) return ""; // safety(TODO:IDictionary<> is not supported)
205207

206-
Schema schema;
207-
if (definitions.TryGetValue(fullName, out schema)) return "#/definitions/" + fullName;
208+
if (definitions.TryGetValue(fullName, out Schema schema)) return "#/definitions/" + fullName;
208209

209210
var properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
210211
var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);

src/MicroBatchFramework/BatchEngine.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.Extensions.Logging;
1+
using Microsoft.Extensions.Logging;
22
using System;
33
using System.Collections.Generic;
44
using System.Collections.ObjectModel;
@@ -118,9 +118,8 @@ public async Task RunAsync(Type type, string[] args)
118118

119119
async Task RunCore(BatchContext ctx, Type type, MethodInfo methodInfo, string[] args, int argsOffset)
120120
{
121-
object instance = null;
122-
object[] invokeArgs = null;
123-
121+
object instance;
122+
object[] invokeArgs;
124123
try
125124
{
126125
if (!TryGetInvokeArguments(methodInfo.GetParameters(), args, argsOffset, out invokeArgs, out var errorMessage))

0 commit comments

Comments
 (0)