First try StructureMap and MVC3 via NuGet

Posted by Angel Escobedo on Stack Overflow See other posts from Stack Overflow or by Angel Escobedo
Published on 2011-03-16T00:08:49Z Indexed on 2011/03/16 0:09 UTC
Read the original article Hit count: 240

Hello Guys,

I'm trying to figure how to config StructureMap for ASP.NET MVC3 I've already using NuGet and I notice that it creates App_Start Folder with a cs file named as StructuremapMVC, so I check it and notice that is the same code but simplified that will be written manually on App_Start section placed on Global.asax...

My Question is when I inject some IoC on my Controllers as the follow (I use this pattern : Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable) :

        private readonly IAsambleaRepository _aRep;
        private readonly IUnitOfWork _uOw;

        public AsambleaController(IAsambleaRepository aRep, IUnitOfWork uOw)
        {
            _aRep = aRep;
            this._uOw = uOw;
        }

        public ActionResult List(string period)
        {
            var rs = _aRep.ByPeriodo(period).ToList<Asamblea>();

            return View();
        }

I got an Exception

Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.

© Stack Overflow or respective owner

Related posts about mvc

Related posts about entity-framework