当前位置:网站首页>.NET Core 加载程序集AssemblyLoadContext
.NET Core 加载程序集AssemblyLoadContext
2022-07-20 20:48:00 【I Can -Jiang】
.NET Core插件热加载-AssemblyLoadContext
AssemblyLoadContext
官方文档:AssemblyLoadContext
AssemblyLoadContext主要提供程序热加载隔离,通过AssemblyLoadContext可以实现在单个进程中加载同一程序集的多个版本。
这篇文章主要讲一下在使用AssemblyLoadContext类的过程中对Load方法,及Resolving事件的理解。
Load
AssemblyLoadContext提供了以多种方式加载热插拔程序集的方式:
按照AssemblyName加载程序集
Load,LoadFromAssemblyName是根据AssemblyName解析和加载程序集。
按照AssemblyPath加载程序集
如果可以确定文件的完全限定路径,可以用LoadFromAssemblyPath来加载程序集。解析程序集的Stream加载程序集
如果无法获取程序集的完全限定路径,可以先根据指定的路径读取到程序集的流,然后以LoadFromStream解析已经读取到的流的方式将程序集加载到指定的AssemblyLoadContext上。
Resolving
在使用Load方法加载程序集的时候可能会遇到正在加载的程序集的依赖程序集还未被加载的情况,这时使用Load加载程序集的时候就会提示指定文件不存在。这时候就会触发到Resolving 事件,可以在这个事件中加载程序集的上下文。
边栏推荐
- 【CVA估值训练营】读懂上市公司年报_第二讲
- [applet] come and develop your first wechat game (detailed process)
- Audience analysis and uninstall analysis have been comprehensively upgraded, and HMS core analysis service version 6.6.0 has been updated
- 金仓数据库KingbaseES数据库管理员指南--15.2. 管理序列
- double、float、long占几个字节?
- 当删则删,这种电容本不该出现
- 同一工作空间下引用不同包的头文件
- let's go——2022年读书活动招募书(第1期)
- 【C语言】文件相关操作
- [binary tree] maximum product of split binary tree
猜你喜欢
PLC的通信模式
Win64 driver kernel programming -32 Enumerating and deleting registry callbacks
leetcode:689. Maximum sum of three non overlapping subarrays
带你认识一下数仓的分区自动管理
《UAV Intelligent Coverage Navigation Based on DRL in Complex Geometrical Environments》翻译
The first blog experts to obtain entity certificates on the list
Rasterization comprehensive analysis
Web3 traffic aggregation platform starfish OS gives players a new paradigm experience of metauniverse
IDEA 导入项目中文注释乱码如何解决
Skillfully using roaringbitmap to deal with the memory diff problem of massive data
随机推荐
AC耦合电容的影响,你真的知道吗?
Intel assembly language programming learning - Chapter 5 process - Part 1
Hutoo - date time tool -dateutil
Semantic matching of English keyword text splitting
Design details related to sap e-commerce cloud Spartacus UI store
TCP sliding window explanation (very practical)
Web3 traffic aggregation platform starfish OS gives players a new paradigm experience of metauniverse
Win64 driver kernel programming -31 Enumerating and deleting image callbacks
【小程序】快来开发你的第一个微信小游戏(详细流程)
金仓数据库KingbaseES数据库管理员指南--14索引的管理
金仓数据库KingbaseES数据库管理员指南--15.3. 管理同义词
巧用RoaringBitMap处理海量数据内存diff问题
IDEA 2021 自动生成serialVersionUID
Web3流量聚合平台Starfish OS,给玩家元宇宙新范式体验
message: 没有找到可以构建的 NPM 包,请确认需要参与构建的 npm 都在 `miniprogramRoot` 目录内,或配置 project.config.json 的 packNpmMa
欧菲光:已布局运动相机、智能家居等光学镜头 / 影像模组,部分产品已实现量产
Web3 Traffic Aggregation Platform Starfish os, Explaining Real Business' p2e 'Ecology
Advanced Mathematics (Seventh Edition) Tongji University exercises 3-1 personal solutions
Methods for JS object to obtain attributes (. And [] methods)
【C语言】文件相关操作