Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Autofac XML配置-定义实例属性_C#_Xml_Properties_Instance_Autofac - Fatal编程技术网

C# Autofac XML配置-定义实例属性

C# Autofac XML配置-定义实例属性,c#,xml,properties,instance,autofac,C#,Xml,Properties,Instance,Autofac,我想使用autofac XML配置定义实例属性 例如: public interface ITest {} // no properties, just plain interface public class ConcreteTest : ITest { public string SomeText {get; set;} } 配置: <!-- language: xml --> <component type="Namespace.ConcreteTe

我想使用autofac XML配置定义实例属性

例如:

public interface ITest {} // no properties, just plain interface
public class ConcreteTest : ITest 
{ 
    public string SomeText {get; set;} 
}
配置:

<!-- language: xml -->
<component
   type="Namespace.ConcreteTest"
   service="Namespace.ITest">
   <properties>
      <property name="SomeText" value="Text to be set on concrete instance" />
   </properties>
</component>
如果ITest有一些文本属性,而不是我的情况,这将很好地工作。 autofac是否可以实现这一点? 我可以告诉autofac在类型属性而不是服务中搜索吗