Rename Load() to Instance for DependencyContext
This commit is contained in:
parent
e39d30ba9c
commit
10ecaeba65
1 changed files with 5 additions and 1 deletions
|
@ -12,6 +12,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
private const string DepsResourceSufix = ".deps.json";
|
private const string DepsResourceSufix = ".deps.json";
|
||||||
|
|
||||||
|
private static Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
||||||
|
|
||||||
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, Library[] compileLibraries, Library[] runtimeLibraries)
|
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, Library[] compileLibraries, Library[] runtimeLibraries)
|
||||||
{
|
{
|
||||||
Target = target;
|
Target = target;
|
||||||
|
@ -21,6 +23,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
RuntimeLibraries = runtimeLibraries;
|
RuntimeLibraries = runtimeLibraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DependencyContext Default => _defaultContext.Value;
|
||||||
|
|
||||||
public string Target { get; }
|
public string Target { get; }
|
||||||
|
|
||||||
public string Runtime { get; }
|
public string Runtime { get; }
|
||||||
|
@ -31,7 +35,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
public IReadOnlyList<Library> RuntimeLibraries { get; }
|
public IReadOnlyList<Library> RuntimeLibraries { get; }
|
||||||
|
|
||||||
public static DependencyContext Load()
|
private static DependencyContext LoadDefault()
|
||||||
{
|
{
|
||||||
var entryAssembly = (Assembly)typeof(Assembly).GetTypeInfo().GetDeclaredMethod("GetEntryAssembly").Invoke(null, null);
|
var entryAssembly = (Assembly)typeof(Assembly).GetTypeInfo().GetDeclaredMethod("GetEntryAssembly").Invoke(null, null);
|
||||||
var stream = entryAssembly.GetManifestResourceStream(entryAssembly.GetName().Name + DepsResourceSufix);
|
var stream = entryAssembly.GetManifestResourceStream(entryAssembly.GetName().Name + DepsResourceSufix);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue