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
in my MVC Controller i have this action to get User Contacts
public ActionResult Contacts(int id)
{
var contacts = _proxy.GetContactsByUser(id);
var mcontacts = Mapper.Map<Contact[], MContact[]>(contacts);
return View(mcontacts);
}
in WCF Service this is my method to get User contacts
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> contacts
is Always null
what exactly doesn't work??
form the first look of it you have not created a map
here is a useful link
http://automapper.codeplex.com/wikipage?title=Lists%20and%20Arrays&referringTitle=Home