开发者

Could not load type 'xxx`1' from assembly from assembly

I know sometimes (here lately) I've been asking more questions than I answer and for that I apologize, but I have yet another question.

Thanks to Kev Ritchie my last issue has been resolved, but that just lead me to another error. When I try debugging (Debug > Start Debugging then I am promptly greeted with this error:

System.TypeLoadException: Could not load type 'GodsCreationTaxidermy.Data.GenericRepository`1' from assembly 'GodsCreationTaxidermy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

This is the code that the view Views > Index

[CanonicalUrlAttribute("Index")]
public virtual ActionResult Index()
{
    var viewModel = image.Find(x => x.is_featured.Value);
    return View(viewModel);
}

And here's a screenshot of the error (I tried several ideas from this site already and none have worked thus far)

Could not load type 'xxx`1' from assembly from assembly

. The line it is highlighting is where I initialize StructureMap, this line

 x.ForRequestedType(typeof(IRepository<>))

Here's the entire initialize code in the Gobal.asax

ObjectFactory.Initialize(x =>
    {
        x.ForRequestedType<IUnitOfWorkFactory>()
            .TheDefaultIsConcreteType<EFUnitOfWorkFactory>()
            .CacheBy(InstanceScope.HybridHttpSession);

        x.ForRequestedType(typeof(IRepository<>))
            .CacheBy(InstanceScope.HybridHttpSession)
            .TheDefaultIsConcreteType(typeof(GenericRepository<>));
    });

Anyone got any ideas, the last thing I tried was to empty everything from the bin folder, clean the solution then rebuild it as st开发者_运维问答ated in this thread from here on SO. This project used to work (not completed but what was completed worked like a charm), all I did was move GenericRepository to GodsCreationTaxidermy.Data from GodsCreationTaxidermy.Data.Repository, not sure how that could have broke this.


This has been resolved. The default Namespace and Assembly had different names. Once I made their names the same the error has disappeared

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜