常见的用途,以及为在.NET应用领域的最佳实践?应用领域、用途、常见、NET

由网友(心淡)分享简介:什么是当一个应用程序中创建新的应用领域的一些准则和最佳做法? What are some guidelines and best practices for when to create new application domains within an application? 此外,什么是用于whithin的应...

什么是当一个应用程序中创建新的应用领域的一些准则和最佳做法?

What are some guidelines and best practices for when to create new application domains within an application?

此外,什么是用于whithin的应用程序?一些常见的用途和如何多个应用程序域的例子

Also, what are some common uses and examples of how multiple application domains are used whithin an application?

推荐答案

我见过的最常见的情况是能够提供可扩展性比主程序不同的安全模式。

The most common scenario I've seen is to be able to provide extensibility with a different security model than the main program.

在一个单独的AppDomain加载插件允许两件事情:

Loading a plugin in a separate AppDomain allows two things:

您可以实施更严格的安全模型 您可以prevent撕裂了你的应用程序中的插件,如果它的车

另外一个不错的应用程序域是加载和检查程序集。在一个单独的AppDomain这样做可以让你以收集从一个单独的程序的信息(或者运行code),然后卸载从你的进程空间中的整个组件。如果直接加载程序集,没有办法卸载它。这也是有用的,如果你希望能够在运行时,升级一个类型的新版本。(如:加载远程组件,后来重装吧)

Another nice use of AppDomains are to load and inspect an assembly. Doing this in a separate AppDomain allows you to glean information (or run code) from a separate assembly, then unload the entire assembly from your process's space. If you load the assembly directly, there is no way to unload it. This is also useful if you want to be able to, at runtime, "upgrade" a type to a new version (ie: load a remote assembly, and reload it later).

阅读全文

相关推荐

最新文章