public override async Task <IEnumerable <Employee> > GetDatas(int pagesize, int pagecount) { var opt = new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }; using (var scope = new TransactionScope(TransactionScopeOption.Required, opt, TransactionScopeAsyncFlowOption.Enabled)) using (var db = new ESContext()) { var source = await this.GetSource(db, this.Start) .OrderBy(l => l.Id) .Skip(pagesize * pagecount) .Take(pagecount) .ToListAsync(); scope.Complete(); return(source.Select(s => new Employee() { FirstName = s.FirstName, LastName = s.LastName, Salary = s.Salary, Birthday = s.Birthday, IsManager = s.IsManager, OfficeHours = s.OfficeHours })); } }
public override bool ToBoolean(ESContext context) { var v1 = _value1.GetValue(context).ToObject(); var v2 = _value2.GetValue(context).ToObject(); return(v1.Equals(v2)); }
public override IESObject Execute(ESContext context) { var value = new ESClass(this); context.UpdateValue(_name, value); return(value); }
public override IESObject GetValue(ESContext context) { var v1 = _value1.GetValue <IESNumber>(context); var v2 = _value2.GetValue <IESNumber>(context); return(new ESNumber(v1.Value * v2.Value)); }
public override Task <int> GetTotalAsync() { using (var db = new ESContext()) { return(this.GetSource(db, this.Start).CountAsync()); } }
public IESObject GetValue(ESContext context) { var value = _rvalue.GetValue(context); _lvalue.SetValue(context, value.Clone()); return(value); }
public override IESObject Execute(ESContext context) { var ret = ESDefault.Value; while (true) { if (_cond.ToBoolean(context)) { ret = _entry.Execute(context); } else { return(ret); } if (context.IsBreak) { context.IsBreak = false; return(ret); } if (context.IsReturn) { return(ret); } } }
public override bool ToBoolean(ESContext context) { var v1 = _value1.GetValue <IESNumber>(context); var v2 = _value2.GetValue <IESNumber>(context); return(v1.Value >= v2.Value); }
public override IESObject Execute(ESContext context) { var ret = ESDefault.Value; var index = 0; while (true) { if (index < Count) { ret = this[index].Execute(context); } else { return(ret); } if (context.IsReturn) { return(ret); } else { index += 1; } } }
public override IESObject Execute(ESContext context) { var ret = ESDefault.Value; var items = _list.GetValue <IESEnumerable>(context); var iter = items.GetEnumerator(); while (true) { if (iter.MoveNext()) { context.UpdateValue(_index.Name, ToVirtual(iter.Current)); ret = _entry.Execute(context); } else { return(ret); } if (context.IsBreak) { context.IsBreak = false; return(ret); } if (context.IsReturn) { return(ret); } } }
public override IESObject Execute(ESContext context) { var ret = ESDefault.Value; var index = _args.begin.GetValue(context).Clone().Cast <IESNumber>(); var end = _args.end.GetValue <IESNumber>(context).Value; var step = _args.step.GetValue <IESNumber>(context).Value; while (true) { if (index.Value < end) { context.UpdateValue(_args.index.Name, index); ret = _entry.Execute(context); } else { return(ret); } if (context.IsBreak) { context.IsBreak = false; return(ret); } if (context.IsReturn) { return(ret); } else { index.Value += step; } } }
public IESObject GetValue(ESContext context) { var func = new ESFunction(context, this); context.UpdateValue(_name, func); return(func); }
public static T GetValue <T>(this IExpressionRight exp, ESContext context) { try { return((T)exp.GetValue(context)); } catch (Exception e) { throw new InvalidOperationException(exp.ToString(), e); } }
private IQueryable <ES.Data.Models.Employee> GetSource(ESContext db, DateTime?start) { var query = db.Employee.AsNoTracking(); if (start.HasValue) { query = query.Where(q => q.Last_Update_Date >= start || q.Creation_Date >= start); } return(query); }
public IESObject New(ESContext context, IESObject[] args) { try { var objects = ESUtility.ToObjects(args, args.Length); var ctor = _value.GetConstructor(ESUtility.ConvertTo(objects, t => t.GetType())); return(ToVirtual(ctor.Invoke(objects))); } catch (Exception e) { throw new InvalidOperationException(string.Format(ToString() + " Arguments: {0}", args.Format()), e); } }
public IESObject GetValue(ESContext context) { if (Count == 1) { return(this[0].Execute(context)); } else { throw new InvalidOperationException("Count != 1"); } }
public IESObject New(ESContext context, IESObject[] args) { context = new ESContext(context); var obj = new ESInstance(); context.UpdateValue("this", obj); _entry.Execute(context); context.ForEach(obj.Add); var ctor = context.GetValue <IESFunction>(_name); ctor.Invoke(args); return(obj); }
public static void Main(string[] args) { var esCtx = new ESContext(); esCtx.Computers.Add(new Computer() { Description = "test", CoolingType = "none", Price = 333, Weight = 2 }); esCtx.SaveChanges(); var tsCtx = new TSContext(); tsCtx.Computers.Add(new TSComputer() { Description = "test", CoolingType = "none", Price = 333, Weight = 2, Server = new Server() { BandWidth = 100 } }); tsCtx.SaveChanges(); }
public static IESObject[] ToArray(ESContext context, List <IExpressionRight> _args) { return(_args.Count == 0 ? _0Vtrs : _args.Select(t => t.Execute(context)).ToArray()); }
public IESObject New(ESContext context, IESObject[] args) { return(_value.New(context, args)); }
public IESObject New(ESContext context, params object[] args) { return(New(context, ToVirtuals(args, args.Length))); }
public IESObject New(ESContext context) { return(New(context, ToVirtuals(null, 0))); }
public IESObject GetValue(ESContext context) { return(_target.GetValue(context).GetProperty(_property.Name)); }
public override IESObject Execute(ESContext context) { return(GetValue(context)); }
public bool ToBoolean(ESContext context) { return(GetProperty(context).GetValue().ToBoolean()); }
public void SetValue(ESContext context, IESObject value) { GetProperty(context).SetValue(value); }
private IESProperty GetProperty(ESContext context) { return(Execute(context).Cast <IESProperty>()); }
public override IESObject Execute(ESContext context) { throw new InvalidOperationException(ToString()); }
public IESObject GetValue(ESContext context) { return(_args.Count == 0 ? new ESTable() : new ESTable(_args.ToDictionary(t => t.Key, t => t.Value.GetValue(context)))); }
public override bool ToBoolean(ESContext context) { return(!_target.ToBoolean(context)); }