public static async Task UpdateState(IEnumerable <InRiverProcessorItem> unprocessed, InRiverState state)
        {
            unprocessed.ForEach(o => o.InRiverState = state);

            IEnumerable <Task <long> > tasks = from InRiverProcessorItem in unprocessed select InRiverProcessorItem.SaveAsync();

            await Task.WhenAll(tasks);
        }
예제 #2
0
        public static async Task <IEnumerable <InRiverProcessorItem> > GetUnprocessed(InRiverState state = InRiverState.None)
        {
            int st = (int)state;

            string sql = "Select * from InRiverSync where InRiverState=" + st.ToString();

            IEnumerable <InRiverProcessorItem> items;

            using (SqlConnection connection = new SqlConnection(APIModels.Data.ConnectionManager.ProductDataHubConnectionString))
            {
                await connection.OpenAsync();

                items = await connection.QueryAsync <InRiverProcessorItem>(sql);
            }

            return(items);
        }