摘要: publicT AddEntity(T entity){//EF4.0的写法添加实体//db.CreateObjectSet().AddObject(entity);//EF5.0的写法db.Entry(entity).State =EntityState.Added;//下面的写法统一db.SaveChanges();returnentity;}publicboolUpdateEntity(T entity){//EF4.0的写法//db.CreateObjectSet().Addach(entity);//db.ObjectStateManager.ChangeObjectState(en 阅读全文
posted @ 2014-03-24 17:52 永不言败,自信相伴 阅读(296) 评论(0) 推荐(0) 编辑