/// <summary> /// Delete directly from a view using a filter /// </summary> /// <typeparam name="TRowSchema"></typeparam> /// <param name="filter"></param> /// <returns></returns> public int ViewDelete <TRowSchema>(Expression <Predicate <TRowSchema> > filter) { LINQString ls = new LINQString(); ls.Visit(filter); Packet p = CreatePacket(); p.Command = "viewdelete-t"; p.Data = new object[] { typeof(TRowSchema).AssemblyQualifiedName, ls.sb.ToString() }; ReturnPacket ret = (ReturnPacket)_client.Send(p); return((int)ret.Data); }
/// <summary> /// Count with LINQ filter /// </summary> /// <typeparam name="TRowSchema"></typeparam> /// <param name="filter"></param> /// <returns></returns> public int Count <TRowSchema>(Expression <Predicate <TRowSchema> > filter) { LINQString ls = new LINQString(); ls.Visit(filter); Packet p = CreatePacket(); p.Command = "gcount"; p.Viewname = typeof(TRowSchema).AssemblyQualifiedName; p.Data = ls.sb.ToString(); ReturnPacket ret = (ReturnPacket)_client.Send(p); return((int)ret.Data); }
/// <summary> /// Execute server side queries /// </summary> /// <typeparam name="TRowSchema"></typeparam> /// <param name="func"></param> /// <param name="filter"></param> /// <returns></returns> public object[] ServerSide <TRowSchema>(ServerSideFunc func, Expression <Predicate <TRowSchema> > filter) { LINQString ls = new LINQString(); ls.Visit(filter); Packet p = CreatePacket(); p.Command = "serverside"; p.Data = new object[] { func.Method.ReflectedType.AssemblyQualifiedName, func.Method.Name, ls.sb.ToString() }; ReturnPacket ret = (ReturnPacket)_client.Send(p); return((object[])ret.Data); }
/// <summary> /// Query with LINQ filter and paging /// </summary> /// <typeparam name="TRowSchema"></typeparam> /// <param name="filter"></param> /// <param name="start"></param> /// <param name="count"></param> /// <returns></returns> public Result <TRowSchema> Query <TRowSchema>(Expression <Predicate <TRowSchema> > filter, int start, int count, string orderby) { LINQString ls = new LINQString(); ls.Visit(filter); Packet p = CreatePacket(); p.Command = "querytype"; p.Start = start; p.Count = count; p.OrderBy = orderby; p.Data = new object[] { typeof(TRowSchema).AssemblyQualifiedName, ls.sb.ToString() }; ReturnPacket ret = (ReturnPacket)_client.Send(p); Result <object> res = (Result <object>)ret.Data; return(GenericResult <TRowSchema>(res)); }
/// <summary> /// Query a View with a LINQ filter with paging /// </summary> /// <typeparam name="TRowSchema"></typeparam> /// <param name="viewname"></param> /// <param name="filter"></param> /// <param name="start"></param> /// <param name="count"></param> /// <returns></returns> public Result <object> Query <TRowSchema>(string viewname, Expression <Predicate <TRowSchema> > filter, int start, int count, string orderby) { LINQString ls = new LINQString(); ls.Visit(filter); Packet p = CreatePacket(); p.Command = "querystr"; p.Viewname = viewname; p.Start = start; p.Count = count; p.Data = ls.sb.ToString(); p.OrderBy = orderby; ReturnPacket ret = (ReturnPacket)_client.Send(p); return((Result <object>)ret.Data); }