实体框架 - 通用GetAll by List <string>

时间:2016-04-21 09:39:23

标签: c# entity-framework generics

我有以下使用实体框架的通用Get方法:

/**
* Adds the possibility to auto scroll through sections on touch devices.
*/
function addTouchHandler(){
    if(isTouchDevice || isTouch){
        //Microsoft pointers
        var MSPointer = getMSPointer();

        $(document).off('touchstart ' +  MSPointer.down).on('touchstart ' + MSPointer.down, touchStartHandler);
        $(document).off('touchmove ' + MSPointer.move).on('touchmove ' + MSPointer.move, touchMoveHandler);
    }
}

/**
* Removes the auto scrolling for touch devices.
*/
function removeTouchHandler(){
    if(isTouchDevice || isTouch){
        //Microsoft pointers
        var MSPointer = getMSPointer();

        $(document).off('touchstart ' + MSPointer.down);
        $(document).off('touchmove ' + MSPointer.move);
    }
}

是否有可能使用ID列表实现相同的通用功能? 像那样:

public TEntity Get(string id)
{
   using (var db = CreateContext())
   {
      return db.Set<TEntity>().Find(id);
   }
}

0 个答案:

没有答案