如何在app.config中指定类的类型?

时间:2014-10-02 14:03:31

标签: c# unity-container app-config

我试图了解如何在app.config中引用一个类。在这种情况下,我想在app.config

中配置和microsoft unity扩展
<extension type="?, ?" />

type="assemblyName, namespace.class"吗?

2 个答案:

答案 0 :(得分:5)

您需要specify the fully qualified type name

  

完全限定类型名称由程序集名称规范,命名空间规范和类型名称组成。

样品:

"System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

在某些情况下,您只需要&#34;命名空间+类型名称,程序集名称&#34;:

"System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework"

答案 1 :(得分:1)

我不知道Unity使用的是什么语法,但标准语法(例如配置部分)是Namespace1.Namespace2.ClassName, AssemblyName

相关问题