mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 06:08:14 +08:00
Merge pull request #261 from binarymash/feature/ReduceBuildWarnings
Feature/reduce build warnings
This commit is contained in:
@ -18,7 +18,7 @@ namespace Ocelot.Configuration.Repository
|
||||
_configFilePath = $"{AppContext.BaseDirectory}/configuration{(string.IsNullOrEmpty(hostingEnvironment.EnvironmentName) ? string.Empty : ".")}{hostingEnvironment.EnvironmentName}.json";
|
||||
}
|
||||
|
||||
public async Task<Response<FileConfiguration>> Get()
|
||||
public Task<Response<FileConfiguration>> Get()
|
||||
{
|
||||
string jsonConfiguration;
|
||||
|
||||
@ -29,10 +29,10 @@ namespace Ocelot.Configuration.Repository
|
||||
|
||||
var fileConfiguration = JsonConvert.DeserializeObject<FileConfiguration>(jsonConfiguration);
|
||||
|
||||
return new OkResponse<FileConfiguration>(fileConfiguration);
|
||||
return Task.FromResult<Response<FileConfiguration>>(new OkResponse<FileConfiguration>(fileConfiguration));
|
||||
}
|
||||
|
||||
public async Task<Response> Set(FileConfiguration fileConfiguration)
|
||||
public Task<Response> Set(FileConfiguration fileConfiguration)
|
||||
{
|
||||
string jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
|
||||
|
||||
@ -45,8 +45,8 @@ namespace Ocelot.Configuration.Repository
|
||||
|
||||
System.IO.File.WriteAllText(_configFilePath, jsonConfiguration);
|
||||
}
|
||||
|
||||
return new OkResponse();
|
||||
|
||||
return Task.FromResult<Response>(new OkResponse());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,19 +12,19 @@ namespace Ocelot.Configuration.Repository
|
||||
|
||||
private IOcelotConfiguration _ocelotConfiguration;
|
||||
|
||||
public async Task<Response<IOcelotConfiguration>> Get()
|
||||
public Task<Response<IOcelotConfiguration>> Get()
|
||||
{
|
||||
return new OkResponse<IOcelotConfiguration>(_ocelotConfiguration);
|
||||
return Task.FromResult<Response<IOcelotConfiguration>>(new OkResponse<IOcelotConfiguration>(_ocelotConfiguration));
|
||||
}
|
||||
|
||||
public async Task<Response> AddOrReplace(IOcelotConfiguration ocelotConfiguration)
|
||||
public Task<Response> AddOrReplace(IOcelotConfiguration ocelotConfiguration)
|
||||
{
|
||||
lock (LockObject)
|
||||
{
|
||||
_ocelotConfiguration = ocelotConfiguration;
|
||||
}
|
||||
|
||||
return new OkResponse();
|
||||
return Task.FromResult<Response>(new OkResponse());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Values;
|
||||
|
||||
@ -14,16 +13,16 @@ namespace Ocelot.ServiceDiscovery
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public async Task<List<Service>> Get()
|
||||
public Task<List<Service>> Get()
|
||||
{
|
||||
return new List<Service>
|
||||
return Task.FromResult(new List<Service>
|
||||
{
|
||||
new Service(_configuration.ServiceName,
|
||||
new ServiceHostAndPort(_configuration.HostName, _configuration.Port),
|
||||
"doesnt matter with service fabric",
|
||||
"doesnt matter with service fabric",
|
||||
new List<string>())
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user