示例#1
0
 private void WriteToDb(TaxFigure record)
 {
     using (var provider = new DbProvider <DbMainContext>())
     {
         provider.AddRecord(record);
         provider.SaveChanges();
         Interlocked.Increment(ref _count);
     }
 }
示例#2
0
        private void HandleLine(string line)
        {
            var task = _factory.StartNew(() =>
            {
                if (_canceled)
                {
                    return;
                }

                var record = new TaxFigure(line);
                if (!record.ValidationErrors.Any())
                {
                    WriteToDb(record);
                }
                else
                {
                    Errors.Add(new TaxFigureViewModel(record));
                }
            });

            _tasks.Add(task);
        }