WPF应用棱镜 - Automapper导致System.Core程序加载失败(WPF Prism

2019-09-28 02:02发布

我有一个WPF 4.5棱镜项目,直到我添加Automapper 3.0到它的正常工作。 当我以从实体框架对象到DTO的翻译加入Automapper我DAL,申请未能在运行时,外壳创建后立即看似。 我的地方阅读Automapper没有完全部署在某些情况下,所以我加入壳牌项目Automapper和Automapper.Net4引用,以及以确保一切部署。

这是错误消息我得到:

Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.

下面是我补充说,导致异常的代码:

namespace DAL
{
[PartCreationPolicy(CreationPolicy.NonShared)]
[Export(typeof(ICampaignActionDataAccess))]
public class CampaignActionDataAccess : ICampaignActionDataAccess
{
    public CampaignActionDataAccess()
    {
        //if (Mapper.FindTypeMapFor<CampaignAction, CampaignActionDTO>() == null)
        //    Mapper.CreateMap<CampaignAction, CampaignActionDTO>();
        //if (Mapper.FindTypeMapFor<CampaignActionGroup, CampaignActionGroupDTO>() == null)
        //    Mapper.CreateMap<CampaignActionGroup, CampaignActionGroupDTO>();
        //if (Mapper.FindTypeMapFor<CampaignActionDescriptor, CampaignActionDescriptorDTO>() == null)
        //    Mapper.CreateMap<CampaignActionDescriptor, CampaignActionDescriptorDTO>();
    }

    public IEnumerable<CampaignActionDTO> GetAllActiveCampaignActions()
    {
        //using (var db = new CampaignActionEntities())
        //{
        //    var actions = (from ca in db.CampaignActions.Include(d => d.CampaignActionDescriptors)
        //                   where ca.IsValid == true
        //                   select ca).ToList();
        //    return Mapper.Map<IEnumerable<CampaignActionDTO>>(actions);
        //}
        throw new NotImplementedException();
    }
}

}

文章来源: WPF Prism application - Automapper causes System.Core load failure