async Task <IList <LogData> > GetLogInformation1(LogQuery logQuery) { if (logQuery == null) { return(new List <LogData>()); } using (var context = new DotNetLogEntities("name=DotNetLogEntities" + logQuery.Environment)) { var result = await context.LogDetails .Where(l => l.Level == logQuery.Level) .Where(s => !string.IsNullOrEmpty(s.StartDateTime) && s.StartDateTime.CompareTo(logQuery.StartDateTime) >= 0) .Where(e => e.EndDateTime != null && e.EndDateTime <= logQuery.EndDateTime) .Where(u => u.Url.Contains(logQuery.Application)) .ToArrayAsync(); return(result.Select(r => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == r.LogId).CustomerSessionID, StartDateTime = r.StartDateTime, EndDateTime = r.EndDateTime, CurrentUrl = r.Url, UrlReferrrer = r.UrlReferrer, Exception = r.Exception }) .OrderByDescending(o => o.StartDateTime) .ToList()); } }
async Task <IList <LogData> > GetLogInformation3(LogQuery logQuery) { if (logQuery == null) { return(new List <LogData>()); } using (var context = new DotNetLogEntities("name=DotNetLogEntities" + logQuery.Environment)) { var result = await context.LogDetails .Where(IsLevelError(logQuery.Level)) //.Where(new GenericSpecification<LogDetail>(IsLevelError(logQuery.Level)).Expression) .Where(NotNull()) .Where(GreaterOrEqual(logQuery.StartDateTime)) .Where(LessThanOrEqual(logQuery.EndDateTime)) .ToArrayAsync(); //context.LogDetails.NotNull<LogDetail,string>(logQuery.Level).GreaterThanOrEqual("",logQuery.StartDateTime); return(result.Select(r => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == r.LogId).CustomerSessionID, StartDateTime = r.StartDateTime, EndDateTime = r.EndDateTime, CurrentUrl = r.Url, UrlReferrrer = r.UrlReferrer, Exception = r.Exception }).OrderByDescending(o => o.StartDateTime) .ToList()); } }
public async Task <IReadOnlyList <LogData> > GetLogInformation(Maybe <LogQuery> logQuery) { if (logQuery.HasNoValue) { return(new List <LogData>()); } using (var context = new DotNetLogEntities("name=DotNetLogEntities" + logQuery.Value.Environment)) { return(await LogInformation(logQuery, context)); } }
public IList <LogData> GetLogInformation(LogQuery logQuery) { if (logQuery == null) { return(new List <LogData>()); } using (var context = new DotNetLogEntities("name=DotNetLogEntities" + logQuery.Environment)) { return(new Filter(context).LogDetails() .For().Error(logQuery.Level).And() .StartDateTime().NotNull(logQuery.StartDateTime).AndAlso().GreaterThanOrEqual(logQuery.StartDateTime) .With().EndDateTime().LessThanOrEqual(logQuery.EndDateTime).Contains(logQuery.Application) .Select(res => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == res.LogId)?.CustomerSessionID, StartDateTime = res.StartDateTime, EndDateTime = res.EndDateTime, CurrentUrl = res.Url, UrlReferrrer = res.UrlReferrer, Exception = res.Exception }).OrderByDescending(o => o.StartDateTime).ToList()); } }
private async Task <IList <LogData> > GetLogInformation2(LogQuery logQuery) { if (logQuery == null) { return(new List <LogData>()); } using (var context = new DotNetLogEntities("name=DotNetLogEntities" + logQuery.Environment)) { return(await context.LogDetails.AsExpandable() .Where(Predicate(logQuery)) .Select(res => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == res.LogId).CustomerSessionID, StartDateTime = res.StartDateTime, EndDateTime = res.EndDateTime, CurrentUrl = res.Url, UrlReferrrer = res.UrlReferrer, Exception = res.Exception }) .OrderByDescending(o => o.StartDateTime) .ToArrayAsync()); } }
private async Task <IReadOnlyList <LogData> > LogInformation(Maybe <LogQuery> logQuery, DotNetLogEntities context) { return(await context.LogDetails .WhichAreError(logQuery.Value.Level) .WhichHaveStartDateTimeGreaterThan(logQuery.Value.StartDateTime) .WhichAreLessThanEqualToEndDateTime(logQuery.Value.EndDateTime) .WhichContainsAppliationInUrl(logQuery.Value.Application) .Select(res => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == res.LogId).CustomerSessionID, StartDateTime = res.StartDateTime, EndDateTime = res.EndDateTime, CurrentUrl = res.Url, UrlReferrrer = res.UrlReferrer, Exception = res.Exception }).OrderByDescending(o => o.StartDateTime).ToArrayAsync()); }
private async Task <IReadOnlyList <LogData> > LogInformation(Maybe <LogQuery> logQuery, DotNetLogEntities context) => await context.LogDetails .Map(ld => ld.Where(x => x.Level == logQuery.Value.Level)) .Map(ld => ld.Where(x => string.Compare(x.StartDateTime, logQuery.Value.StartDateTime, StringComparison.Ordinal) >= 0)) .Map(ld => ld.Where(x => x.EndDateTime <= logQuery.Value.EndDateTime)) .Map(ld => ld.Where(x => x.Url.Contains(logQuery.Value.Application))) .Select(res => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == res.LogId).CustomerSessionID, StartDateTime = res.StartDateTime, EndDateTime = res.EndDateTime, CurrentUrl = res.Url, UrlReferrrer = res.UrlReferrer, Exception = res.Exception }).OrderByDescending(o => o.StartDateTime).ToArrayAsync();
private async Task <IReadOnlyList <LogData> > LogInformation(Maybe <LogQuery> logQuery, DotNetLogEntities context) => await context.LogDetails .Where(new ErrorSpecification(logQuery.Value.Level).ToExpression()) .Where(new StartDateTimeSpecification(DateTime.Parse(logQuery.Value.StartDateTime)).ToExpression()) .Where(new EndDateTimeSpecification(logQuery.Value.EndDateTime).ToExpression()) .Where(new ApplicationSpecification(logQuery.Value.Application).ToExpression()) .Select(res => new LogData() { CustomerSessionId = context.LogMains.FirstOrDefault(c => c.LogId == res.LogId).CustomerSessionID, StartDateTime = res.StartDateTime, EndDateTime = res.EndDateTime, CurrentUrl = res.Url, UrlReferrrer = res.UrlReferrer, Exception = res.Exception }).OrderByDescending(o => o.StartDateTime).ToArrayAsync();