0

This is my code:

public List<Core.Domain.ActivityDepreciationType> GetAllActivityDepreciationType()
    {
        using (TrenStarEAMEntities1 dbContext = new TrenStarEAMEntities1())
        {
            // Exception occurs here --v
            var efActivityDepriciationType = dbContext.ActivityDepreciationTypes.ToList();

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap<EFModels.ActivityDepreciationType, Core.Domain.ActivityDepreciationType>();
            });
            var mapper = config.CreateMapper();
            return mapper.Map<List<Core.Domain.ActivityDepreciationType>>(efActivityDepriciationType);
        }
    }

My task is to scaffold tables in a database in MVC.

Error occurs at line:

var efActivityDepriciationType = dbContext.ActivityDepreciationTypes.ToList();

This is what the error says:

System.Data.Entity.Core.MetadataException occurred Message=Unable to load the specified metadata resource. Source= StackTrace:

kayess
  • 3,384
  • 9
  • 28
  • 45
  • Please [edit your question](https://stackoverflow.com/posts/48188389/edit) to show in which line / which part of your code the Exception occurs. – Peter B Jan 10 '18 at 13:34
  • Check if this similar question will provide you with answers: https://stackoverflow.com/q/1074337/1220550 – Peter B Jan 10 '18 at 13:38
  • i tried deleting the connection strings then deleting the model and adding it again and also tried renaming the edmx . it does not work – Denise Kuppan Jan 10 '18 at 14:06

0 Answers0