Unity を使用して文字列値をプロパティに挿入したいと考えています。機能する構文が見つかりません。この場合、PutBunniesHere
この場合のエラーは、「type」を値の有効な属性として認識しないことです。以前は型を解決できなかったので、それを追加しました。
クラスには次のプロパティがあります。
[Dependency("PutBunniesHere")]
public string PutBunniesHere { get; set; }
そして、これは私がユニティに使用している構成です。
<?xml version="1.0" encoding="utf-8" ?>
<unity2 xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IInjectMe1" type="CommonLib.IInjectMe1, CommonLib"/>
<alias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
<container name="unity2">
<register type="CommonLib.IInjectMe2, CommonLib" name="Injected2" mapTo="CommonLib.InjectMe2, CommonLib">
<lifetime type="singleton"/>
<constructor>
<param name="theDependency" dependencyType="IInjectMe1" />
</constructor>
<property name="PutBunniesHere">
<value value="my bunnies" type="System.String"/>
</property>
</register>
</container>
</unity2>