本文整理汇总了C#中ILibraryManager.GetLibraries方法的典型用法代码示例。如果您正苦于以下问题:C# ILibraryManager.GetLibraries方法的具体用法?C# ILibraryManager.GetLibraries怎么用?C# ILibraryManager.GetLibraries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILibraryManager
的用法示例。
在下文中一共展示了ILibraryManager.GetLibraries方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Program
public Program(ILibraryManager libraryManager)
{
foreach (var lib in libraryManager.GetLibraries())
{
Console.WriteLine(lib.Name);
}
}
示例2: Program
public Program(ILibraryManager libraryManager, IServiceProvider serviceProvider)
{
foreach(var library in libraryManager.GetLibraries())
{
Console.WriteLine(library.Name);
}
}
示例3: RegisterAll
public void RegisterAll(ContainerBuilder builder,ILibraryManager libraryManager)
{
var libraries = libraryManager.GetLibraries();
_assemblies = GetAssemblies(libraries);
RegisterTypes(builder,typeof(ISingletonDependency)).SingleInstance();
RegisterTypes(builder,typeof(ITransientDependency)).InstancePerLifetimeScope();
foreach(var assembly in _assemblies)
{
var types = assembly.GetTypes();
Mapper.MapperBootstrapper.ConfigureMapper(types);
}
}
示例4: Program
public Program(IApplicationEnvironment app,
IRuntimeEnvironment runtime,
IRuntimeOptions options,
ILibraryManager libraryManager,
IAssemblyLoaderContainer container,
IAssemblyLoadContextAccessor accessor)
{
Console.WriteLine("ApplicationName: {0} {1}", app.ApplicationName, app.Version);
Console.WriteLine("ApplicationBasePath: {0}", app.ApplicationBasePath);
Console.WriteLine("Framework: {0}", app.RuntimeFramework.FullName);
Console.WriteLine("Runtime: {0} {1} {2}", runtime.RuntimeType, runtime.RuntimeArchitecture, runtime.RuntimeVersion);
Console.WriteLine("System: {0} {1}", runtime.OperatingSystem, runtime.OperatingSystemVersion);
var names = libraryManager
.GetLibraries()
.SelectMany(p => p.LoadableAssemblies)
.Select(p => p.FullName).ToArray();
var first = names.First();
}
示例5: GetAssemblies
public static IEnumerable<Assembly> GetAssemblies(string path, IAssemblyLoaderContainer assemblyLoaderContainer, IAssemblyLoadContextAccessor assemblyLoadContextAccessor, ILibraryManager libraryManager)
{
List<Assembly> assemblies = new List<Assembly>();
IAssemblyLoadContext assemblyLoadContext = assemblyLoadContextAccessor.Default;
using (assemblyLoaderContainer.AddLoader(new DirectoryAssemblyLoader(path, assemblyLoadContext)))
{
foreach (string extensionPath in Directory.EnumerateFiles(path, "*.dll"))
{
string extensionFilename = Path.GetFileNameWithoutExtension(extensionPath);
assemblies.Add(assemblyLoadContext.Load(extensionFilename));
}
}
// We must not load all of the assemblies
foreach (Library library in libraryManager.GetLibraries())
if (AssemblyManager.IsCandidateLibrary(libraryManager, library))
assemblies.AddRange(library.Assemblies.Select(an => assemblyLoadContext.Load(an)));
return assemblies;
}
示例6: GetLibraries
private static IEnumerable<Library> GetLibraries(ILibraryManager libraryManager)
{
return libraryManager.GetLibraries()
.Where(lbl => !lbl.Name.StartsWith("Microsoft"))
.Where(lbl => !lbl.Name.StartsWith("System"));
}