Пример #1
0
        public static Task <ICollection <T> > GetObjectsAsync <T>(this Session session, CriteriaOperator criteriaOperator = null, SortingCollection sorting = null, int skipSelectedRecords = 0, int topSelectedRecords = int.MaxValue, bool selectDeleted = false, bool force = false)
        {
            var tcs = new TaskCompletionSource <ICollection <T> >();

            AsyncLoadObjectsCallback h = null;

            h = (collections, exception) =>
            {
                h = null;
                if (exception != null)
                {
                    tcs.SetException(exception);
                }
                else
                {
                    tcs.SetResult(collections[0].OfType <T>().ToArray());
                }
            };

            session.GetObjectsAsync(session.GetClassInfo <T>(), criteriaOperator, sorting, skipSelectedRecords, topSelectedRecords, selectDeleted, force, h);

            return(tcs.Task);
        }
Пример #2
0
 object IObjectLayer.LoadObjectsAsync(Session session, ObjectsQuery[] queries, AsyncLoadObjectsCallback callback)
 {
     return(base.LoadObjectsAsync(session, PatchCriteria(queries), callback));
 }