So I’m chugging along on this MVC application and all is running smoothly. I get up to fix a bite to eat and the next time I build I’m greeted with 4 of these errors:
> Error 16 Cannot implicitly convert type
> 'System.Collections.Generic.IEnumerable<>
> [c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll]'
> to
> 'System.Collections.Generic.IEnumerable<>
> [c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll]'.
> An explicit conversion exists (are you missing a cast?)
Keep in mind that there is actually something in IEnumerable<>, I just removed it.
This is the 2 classes where the errors are at
public partial class PriceListController : Controller
{
[CanonicalUrlAttribute("PriceList")]
[CompressionFilter(Order = 1)]
[CacheFilter(Duration = 120, Order = 2)]
public virtual ActionResult Index()
{
GodsCreationTaxidermyEntities context = new GodsCreationTaxidermyEntities();
var viewModel = new PriceListViewModel() { PriceListAnimals = context.GetAnimalListForPriceList() };
return View(viewModel);
}
[CompressionFilter(Order = 1)]
[CacheFilter(Duration = 120, Order = 2)]
public virtual ActionResult List(string animal)
{
GodsCreationTaxidermyEntities context = new GodsCreationTaxidermyEntities();
var viewModel = new PriceListIndexViewModel() { AnimalPrices = context.GetPriceListByAnimal(animal) };
return View(viewModel);
}
}
public partial class GalleryController : Controller
{
//
// GET: /Gallery/
[CanonicalUrlAttribute("Gallery")]
[CompressionFilter(Order = 1)]
[CacheFilter(Duration = 120, Order = 2)]
public virtual ActionResult Index()
{
GodsCreationTaxidermyEntities context = new GodsCreationTaxidermyEntities();
var viewModel = new GalleryIndexViewModel() { GalleryAnimals = context.GetAnimalListForGallery() };
return View(viewModel);
}
[CompressionFilter(Order = 1)]
[CacheFilter(Duration = 120, Order = 2)]
public virtual ActionResult List(string animal)
{
GodsCreationTaxidermyEntities context = new GodsCreationTaxidermyEntities();
var viewModel = new GalleryListViewModel() { GalleryImages = context.GetGalleryImageByAnimal(animal) };
return View(viewModel);
}
}
I’ve checked the DAL and Repository and no errors coming from there.
Got those errors resolved, it was my fault because I was calling the wrong methods from the DAL/Repository.