示例#1
0
        public void Write(OrderByContract orderBy)
        {
            if (orderBy == null)
            {
                throw new ArgumentNullException("orderBy");
            }

            Trace(() =>
            {
                Write((int)orderBy.Type);
                Write(orderBy.Expression);
            });
        }
示例#2
0
        public void Read(out OrderByContract orderBy, InterfaceType.Factory iftFactory)
        {
            orderBy = Trace(() =>
            {
                int type;
                Read(out type);

                SerializableExpression expression;
                Read(out expression, iftFactory);

                return(new OrderByContract()
                {
                    Type = (OrderByType)type,
                    Expression = expression
                });
            });
        }
示例#3
0
 /// <summary>
 /// Returns a list of objects from the datastore, matching the specified filters.
 /// </summary>
 /// <param name="version">Current version of generated Zetbox.Objects assembly</param>
 /// <param name="type">Type of Objects</param>
 /// <param name="maxListCount">Max. ammount of objects</param>
 /// <param name="eagerLoadLists">If true list properties will be eager loaded</param>
 /// <param name="filter">Serializable linq expression used a filter</param>
 /// <param name="orderBy">List of derializable linq expressions used as orderby</param>
 /// <returns>the found objects</returns>
 public byte[] GetList(Guid version, SerializableType type, int maxListCount, bool eagerLoadLists, SerializableExpression[] filter, OrderByContract[] orderBy)
 {
     using (Logging.Facade.DebugTraceMethodCallFormat("GetList", "type={0}", type))
     {
         DebugLogIdentity();
         try
         {
             if (type == null) { throw new ArgumentNullException("type"); }
             var ifType = _iftFactory(type.GetSystemType());
             int resultCount = 0;
             var ticks = _perfCounter.IncrementGetList(ifType);
             try
             {
                 using (IZetboxContext ctx = _ctxFactory())
                 {
                     var filterExpresstions = filter != null ? filter.Select(f => SerializableExpression.ToExpression(f)).ToList() : null;
                     IEnumerable<IStreamable> lst = _sohFactory
                         .GetServerObjectHandler(ifType)
                         .GetList(version, ctx, maxListCount,
                             filterExpresstions,
                             orderBy != null ? orderBy.Select(o => new OrderBy(o.Type, SerializableExpression.ToExpression(o.Expression))).ToList() : null);
                     resultCount = lst.Count();
                     return SendObjects(lst, eagerLoadLists).ToArray();
                 }
             }
             finally
             {
                 _perfCounter.DecrementGetList(ifType, resultCount, ticks);
             }
         }
         catch (Exception ex)
         {
             Helper.ThrowFaultException(ex);
             // Never called, Handle errors throws an Exception
             return null;
         }
     }
 }