相关疑难解决方法(0)

自动映像丢失类型映射配置或不支持的映射?

实体模型

public partial class Categoies
{
    public Categoies()
    {
        this.Posts = new HashSet<Posts>();
    }

    public int Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public Nullable<int> PositionId { get; set; }

    public virtual CategoryPositions CategoryPositions { get; set; }
    public virtual ICollection<Posts> Posts { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

查看模型

public class CategoriesViewModel
{
    public int Id { get; set; }

    [Required(ErrorMessage = "{0} alan? bo? b?rak?lmamal?d?r!")]
    [Display(Name = "Kategori …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc automapper

64
推荐指数
9
解决办法
14万
查看次数

如何将AutoMapper与Post Action一起使用

在我的解决方案中,我有一个ASP.NET MVC3项目,以及一个与数据库一起工作的WCF项目.我使用entity framework self trackingAutoMapper映射对象.

我的问题是:我如何使用AutoMapper邮政行动像箱子和删除和编辑方法

我看到这个问题,但没有帮助我这给我一个错误argument type '...' is not assignable to parameter type '...'

      [HttpPost]
      public ActionResult Create(MUser muser)
      {
        if (ModelState.IsValid)
        {
            Mapper.CreateMap<User, MUser>();
            var user = Mapper.Map<User, MUser>(muser);
            _proxy.SaveUser(user);
            return RedirectToAction("Index");

        }
        return View(muser);
      }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

wcf automapper self-tracking-entities asp.net-mvc-3

2
推荐指数
1
解决办法
848
查看次数