Make work on Xplat CoreCLR
This commit is contained in:
parent
599f05e134
commit
acefcff61d
|
|
@ -21,11 +21,25 @@ namespace MusicStore
|
|||
|
||||
private bool? _isNano;
|
||||
private bool? _isMono;
|
||||
private bool? _isWindows;
|
||||
|
||||
public Platform(IRuntimeEnvironment runtimeEnvironment)
|
||||
{
|
||||
_runtimeEnvironment = runtimeEnvironment;
|
||||
}
|
||||
|
||||
public bool IsRunningOnWindows
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_isWindows == null)
|
||||
{
|
||||
_isWindows = _runtimeEnvironment.OperatingSystem.Equals("Windows", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
return _isWindows.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRunningOnMono
|
||||
{
|
||||
|
|
@ -46,7 +60,7 @@ namespace MusicStore
|
|||
{
|
||||
if (_isNano == null)
|
||||
{
|
||||
var osVersion = new Version(_runtimeEnvironment.OperatingSystemVersion);
|
||||
var osVersion = new Version(_runtimeEnvironment.OperatingSystemVersion ?? "");
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace MusicStore
|
|||
{
|
||||
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
|
||||
|
||||
var useInMemoryStore = _platform.IsRunningOnMono || _platform.IsRunningOnNanoServer;
|
||||
var useInMemoryStore = !_platform.IsRunningOnWindows || _platform.IsRunningOnMono || _platform.IsRunningOnNanoServer;
|
||||
|
||||
// Add EF services to the services container
|
||||
if (useInMemoryStore)
|
||||
|
|
|
|||
Loading…
Reference in New Issue