다음 결과를 필터링 할 수있는 람다 식을 전달할 수 있으며 결과 목록에서 작동하는 콜백 메서드를 사용할 수 있습니다. 이것은 내 시스템에서 하나의 특정 테이블 일 뿐이며, 나는이 구조를 반복해서 사용할 것이다. 일반적인 방법, 예를 들어 테이블을 매개 변수 (공정하게 ADO.NET dataservice 엔티티)로 취하고 필터 (람다 표현식)를 전달하는 DBget을 빌드 할 수 있습니다. 이것일반 및 데이터베이스 액세스
public void getServiceDevelopmentPlan(Expression<Func<tblServiceDevelopmentPlan, bool>> filter, Action<List<tblServiceDevelopmentPlan>> callback)
{
var query = from employerSector in sdContext.tblServiceDevelopmentPlan.Where(filter)
select employerSector;
var DSQuery = (DataServiceQuery<tblServiceDevelopmentPlan>)query;
DSQuery.BeginExecute(result =>
{
callback(DSQuery.EndExecute(result).ToList<tblServiceDevelopmentPlan>());
}, null);
}
내 첫 배쉬는 다음과 같습니다
public delegate Action<List<Table>> DBAccess<Table>(Expression<Func<Table, bool>> filter);