다음 데이터베이스 구조를 사용하고 EntityFramework를 사용하십시오.쿼리 한 후 누락 된 SQL 항목을 확인하는 방법은 무엇입니까?
매 5 분 'phasecount'표 '상'의 각 레코드에 대한 레코드를 가져옵니다.
using (Entities db = new Entities())
{
db.ContextOptions.LazyLoadingEnabled = false;
int numberofcontrollers = (from a in db.Junctions select a).Count();
List<int> controllerids = (from b in db.Junctions select b.Id).ToList();
var configuration = (from c in db.Configurations select c).First();
DateTime laststamp = (from s in db.Stamps select s.Time).Max();
DateTime firststamp = laststamp.AddMinutes(-1 * (CountIntervalsBefore - 1) * TimeSliceLength);
var stamps = from s in db.Stamps.Include("PhaseCounts.Phase") where s.Time >= firststamp && s.Time <= laststamp orderby s.Id select s;
// check consistency; number of stamps should equal timeslices*controllers
if (stamps.Count() != CountIntervalsBefore * numberofcontrollers)
{
//counts are not available for all timeslices and controllers
//do extended consistency check (and use dummy data?)
}
}
모든 단계에서 각 단계마다 1 시간 동안을 선택하고 싶습니다.
스탬프는 일반적으로 72, 즉 12 분 5 분 슬라이스 * 6 교차점과 같습니다.
72와 같지 않은 경우 데이터가 누락 된 위상 및 타임 스탬프를 결정하는 방법은 무엇입니까?
감사합니다. 똑똑한 조인으로이 작업을 수행하고 싶었지만 지금까지는 어떻게 찾을 수없는 ... – Cornelis