I use Unity 2.0 with asp.net mvc3 in my project. An exception is thrown when I try to configure TestEntities : ObjectContext
in my Repository
class.
public class UserRepository:IUser
{
//TestEntities ctx = new TestEntities();
[Dependency]
public TestEntities ctx { get; set; }
//...
}
This is the exception message:
The type TestEntities has multiple constructors of length 1. Unable to disambiguate.
XML configuration:
<?xml version="1.0" encoding="utf-8" ?>
<unity xmlns="schemas.microsoft.com/practices/2010/unity">
<container>
<register type="DomainModel.Entity.TestEntities, DomainModel"
mapTo="DomainModel.Entity.TestEntities, DomainModel">
<lifetime type="perthread"/>
</register>
<register type="DomainModel.Abstract.IUser, DomainModel"
mapTo="DomainModel.Concrete.UserRepository, DomainModel">
<lifetime type="perthread"/>
</register>
</container>
</unity>