public class BaseRepository<T> where T : class { //实例化EF框架 DataModelContainer db = new DataModelContainer(); //添加 public T AddEntities(T entity) { db.Entry<T>(entity).State = EntityState.Added; …
首先,我们来看一下tp框架里面的查询方法: 查询有很多种,代码如下: <?php namespace Admin\Controller; use Think\Controller; class MainController extends Controller { public function showList() { echo "大苹果商城"; } public function test() { //数据访问 //造模型对象 $nation = D("Nation…