EF 两种删除方式的比较
UserInfo user = from u in context.UserInfo where u.Id=343 select u;
context.UserInfo.Remove(user);
用Remove()方法时,必须先从EF中查到才能删除
UserInfo user = new UserInfo(){Id=343};
context.Entry<UserInfo>(user).State = System.Data.EntityState.Deleted;
用这种方法不用先查再删除,其实内部做了查询,推荐用这种;