RepositoryPatternプロジェクトには、以下のインターフェースが定義されています。
using System.Collections.Generic;
using Domain;
namespace RepositoryPattern
{
public interface IRepository
{
List<Car> GetCars();
}
}
私のXML設定の結束セクションはこのように見えます:
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<namespace name="RepositoryPattern" />
<container>
<register type="IRepository" mapTo="SqlServerRepository" />
</container>
</unity>
アプリケーションを実行すると、次のエラーが発生します。
The type name or alias IRepository could not be resolved. Please check your configuration file and verify this type name.
回答:
回答№1は2わかった。私はアセンブリセクションを追加する必要がありました:
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name ="RepositoryPattern"/>
<namespace name="RepositoryPattern" />
<container>
<register type="IRepository" mapTo="SqlServerRepository" />
</container>
</unity>