简体   繁体   English

覆盖动态创建和加载的程序集

[英]Override dynamically created and loaded assembly

Currently i create assemblies for my application dynamically at startup. 目前,我在启动时为应用程序动态创建程序集。 Is it possible to create new assemblies at runtime and override existing assemblies in the AppDomain ? 是否可以在运行时创建新程序集并覆盖AppDomain现有程序集?

I know that this would be possible if i work with different AppDomain s and app domain bridges, but i want to avoid this. 我知道,如果我使用不同的AppDomain和应用程序域桥,这将是可能的,但我想避免这种情况。

My aim 我的目标

We create an Entity-Framework DB-Context with all models dynamically at application startup. 我们在应用程序启动时动态创建带有所有模型的Entity-Framework DB-Context。 But at runtime maybe the database scheme change, and i want to have the changes represented in the entity framework dbcontext and models. 但是在运行时,数据库方案可能会发生更改,并且我希望更改以实体框架dbcontext和模型表示。

If the types from your dynamic assembly are used, then it cannot overridden, but if not used, it will eventually be unloaded. 如果使用了动态程序集中的类型,则无法覆盖它,但是如果不使用它,则最终将其卸载。 Then it will be possible to override it. 这样就可以覆盖它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM