如何将实体集合设置为null?我尝试过这样的事情
user.movies = new List<movie>();
但是我收到了这个错误:
Cannot implicitly convert type 'System.Collections.Generic.List<MvcApplication2.dal.movie>' to 'System.Data.Objects.DataClasses.EntityCollection<MvcApplication2.dal.movie>'
答案 0 :(得分:5)
user.movies.Clear();
或user.movies = null;