English 中文(简体)
与许多关系有 " 一与许多关系 " 的 " 自我追踪实体 "
原标题:Self-Tracking Entities with One to many relationship

I Use Self-Tracking Entities with WCF to Work With data and asp.net MVC3 As a client any idea why this code doesn t work

我的MVC 主计长 我有这个动作 来获取用户联系人

      public ActionResult Contacts(int id)
      {
            var contacts = _proxy.GetContactsByUser(id);
            var mcontacts = Mapper.Map<Contact[], MContact[]>(contacts);

            return View(mcontacts);
      }

在WCF Service中,这是我获得用户联系人的方法。

      public List<Contact> GetContactsByUser(int id)
      {

                 var user = _context.Users.FirstOrDefault(u => u.UserID == id);
                List<Contact> contacts = user.Contacts.ToList();
                return contacts;

      }

my problem is list< contact> 联系人 总是空

问题回答

到底什么不起作用?

窗体的表情表情,您尚未创建地图

 public ActionResult Contacts(int id)
      {
            var contacts = _proxy.GetContactsByUser(id);
            Mapper.CreateMap<Contact,MContact>();
            var mcontacts = Mapper.Map<Contact[], MContact[]>(contacts);

            return View(mcontacts);
      }

这里是一个有用的链接

< a href=" "http://automapper.coppledplex.com/wikipage? title=Lists%20and%20Arrays& referringTitle=Home" rel=“ nofollow" >http://automapper.copple.com/wikipage? title=Lists%20and%20Arrays& referringTitle=Home





相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签