xaisoft
xaisoft

Reputation: 3451

The type name or alias xxxx could not be resolved. Please check your configuration file and verify this type name

I have the following interface defined in a RepositoryPattern project:

using System.Collections.Generic;
using Domain;

namespace RepositoryPattern
{
    public interface IRepository
    {
        List<Car> GetCars();
    }
}

The unity section of my XML configuartion looks like this:

  <unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <namespace name="RepositoryPattern" />
    <container>
      <register type="IRepository" mapTo="SqlServerRepository" />
    </container>
  </unity>

When I run the application, I get the following error:

The type name or alias IRepository could not be resolved. Please check your configuration file and verify this type name.

Upvotes: 0

Views: 2871

Answers (1)

xaisoft
xaisoft

Reputation: 3451

I got it. I needed to add the assembly section:

  <unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <assembly name ="RepositoryPattern"/>
    <namespace name="RepositoryPattern" />
    <container>
      <register type="IRepository" mapTo="SqlServerRepository" />
    </container>
  </unity>

Upvotes: 2

Related Questions