本文介绍了我怎么可以强制C#编译过程,包括在代码中不使用组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有应用程序调用Company.Application。它使用的库:

I have application called Company.Application. It does uses libraries:


  • Company.InversionOfControl

  • Company.Functionality.Contracts

  • Company.Functionality

该应用程序使用InversionOfControl用来侦察组件部分应用程序域:

The application uses InversionOfControl to scout the assemblies part app domains using:

appDomain.GetAssemblies()

的问题是,在 Company.Application 从不引用代码的 Company.Functionality 直接,但依赖于 Company.Functionality.Contracts Company.InversionOfControl 以情侣的功能定义Company.Functionality和注入它的 Company.Application

The problem is that the Company.Application never references code from Company.Functionality directly but relies on interfaces defined in Company.Functionality.Contracts and Company.InversionOfControl to couple the functionality defined Company.Functionality and inject it in Company.Application

正因为如此,有时应用程序的域不认为大会的 Company.Functionality (即 appDomain.GetAssemblies()的)。

Because of this sometimes the application's domain does not sees the assembly Company.Functionality (ie appDomain.GetAssemblies() ).

我的问题是 - 有没有办法迫使其中的 Company.Functionality

My question is - is there way to force including of Company.Functionality ?

推荐答案

?通常情况下,根应该知道的一切建立上下文。如果这样做dinamically比IoC的图书馆应该进行参数设置通过代码来组装加载到应用程序域。如果不是这种情况,您必须通过手动AppDomain.LoadFrom加载它。
大部分集装箱只见要求其中两个抽象和实施参考,并可见创建绑定的地方。

Usually the root should know everything to build up context. If this done dinamically than the IoC library should be parameterised to load the assembly to the app domain by code. If this not the case you have to load it manually via AppDomain.LoadFrom.Most container I saw require a place where both abstraction and implementation is referenced and visible to create the binding.

这篇关于我怎么可以强制C#编译过程,包括在代码中不使用组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 12:43