62,074
社区成员
发帖
与我相关
我的任务
分享
BLL.CityService csbll = new BLL.CityService();
Models.City City = csbll.Find(City_CityID);
Models.Customer model = new Models.Customer();
model.City = City;
.........//各个属性赋值
........
bll.Add(model);//这句报错
public T Add(T entity)
{
nContext.Entry<T>(entity).State = System.Data.Entity.EntityState.Added;
nContext.SaveChanges();//报错位置
return entity;
}
/// <summary>
/// 公司所在城市
/// </summary>
[Required(ErrorMessage = "必填")]
[Display(Name = "公司所在城市")]
public virtual City City { get; set; }//引用属性