Mercurial > pub > bltoolkit
view Demo/Silverlight/Client/MainPage.xaml.cs @ 4:f757da6161a1
!bug 100 + 2h fixed gregression
author | cin |
---|---|
date | Sun, 24 Aug 2014 17:57:42 +0400 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
using System; using System.Linq; using System.Threading; using System.Windows.Controls; using BLToolkit.Data.Linq; namespace Client { public partial class MainPage : UserControl { public class Data { public string Name; public int Sum; } public MainPage() { InitializeComponent(); ThreadPool.QueueUserWorkItem(_ => { try { using (var dm = new DataModel()) { var q = from c in dm.Categories where !c.CategoryName.StartsWith("Con") orderby c.CategoryName select c.CategoryName; (from t in dm.Categories group t by t.CategoryName into g select new Data { Name = g.Key, Sum = g.Sum(a => a.CategoryID) }).ToList(); var text = string.Join("\n", q.ToArray()); Dispatcher.BeginInvoke(() => OutputText.Text = text); dm.BeginBatch(); dm.Categories.Delete(c => c.CategoryID == -99999); dm.Categories.Delete(c => c.CategoryID == -999999); dm.CommitBatch(); } } catch (Exception ex) { Dispatcher.BeginInvoke(() => OutputText.Text = ex.Message); } //new ServiceReference1.TestLinqWebServiceSoap(); }); } } }