It depends on what version of EF you are using and even if I knew what version the possibilities are still endless. :) I'll give you a few examples.
Version 1.0
public void Update(User user)
{
using (var context = new ObjectContext(""))
{
user.Blog = GetBlog(user.Id);
context.ApplyPropertyChanges("User", user);
}
}
private Blog GetBlog(int userId)
{
using (var context = new ObjectContext(""))
{
return (from u in context.Users
where u.Id == userId
select u).FirstOrDefault();
}
}
In version 2 and POCO:
public class User
{
public virtual int Id { get; set; }
public virtual Blog Blog { get; set; }
public void AddEntry(Entry entry)
{
if (Blog.Entries == null)
Blog.Entries = new List<Entry>();
entry.Blog = Blog;
Blog.Entries.Add(entry);
}
}
public class Blog
{
public virtual int Id { get; set; }
public virtual IList<Entry> Entries { get; set; }
}
Then of course there are a multitude of options using the EntityKey values, loading references etc. I tend to use the easiest variant at hand though.
EDIT: Ok got your question. MVC is very forgiving if you treat it right. I would start with the following: When you create your select list thats fine:
ViewData["service_id"] = new SelectList(cats, "id", "name", selectedService);
But to use this select list correctly in MVC you can actually assign it like the following:
<%= Html.DropDownList("Service.Id", (IEnumerable<SelectListItem>)ViewData["service_id"])%>
The thing to note here is Service.Id. This means that whatever value is selected in the drop down list get's assigned to Platform.Service.Id. When you persist your changes Entity Framework does the work for you.