Ejemplo n.º 1
0
        public Task <int> SaveChangesAsync()
        {
            EfWip.WaitBombIf();                         // wait for any previous async SQL traffic by EF to finish
            AdoWip.WaitBombIf();                        // ditto wait for any previous async p_ActionWebPage sproc operation to complete [avoid internal deadlocks]
#if WIP
            LastEfCmd = EfWipEnum.SaveChangesAsync;
#endif
            Task <int> rslt;
            EfWip = rslt = EfDomain.SaveChangesAsync();

            // 3.   previous upload, but exec sproc deferred to after SaveChanges, i.e. now
            if (ActionPage != null)
            {
                EfWip.WaitBombIf();                 // wait for repository's SaveChangesAsync to finish (e.g. to persist new redirected WebPage)
                SaveLinks(ActionPage);              // actually invoke p_ActionWebPage sproc
                ActionPage = null;
                AdoWip.WaitBombIf();                // wait for parallel ADO to quiesce (i.e. p_Action sproc)
            }

            return(rslt);                            // caller can await to get integer rowcount
        }
Ejemplo n.º 2
0
        /*
         * WebPage PutWebPage(WebPage webpage)
         * {
         *  if (EfDomain.WebPages.Local.Count == 0)             // read entire table on first call
         *  {
         *      var webPages = EfDomain.WebPages.ToList();
         *      Console.WriteLine($"pagecnt={EfDomain.WebPages.Local.Count}");
         *  }
         *
         *  // try local cache before external trip to DB
         *  var wptemp =
         *      //EfDomain.WebPages.Local.FirstOrDefault(row => row.Url.Equals(webpage.Url, StringComparison.InvariantCultureIgnoreCase))
         *      EfDomain.WebPages.FirstOrDefault(row => row.Url.Equals(webpage.Url, StringComparison.InvariantCultureIgnoreCase));
         *  if (wptemp == null)
         *  {
         *      return EfDomain.WebPages.Add(webpage);
         *  }
         *  if (!webpage.DraftFilespec.Equals(wptemp.DraftFilespec, StringComparison.InvariantCultureIgnoreCase))
         *  {
         *      if (wptemp.DraftFilespec == null)
         *      {
         *          Console.WriteLine($"PutHost[DraftFilespec] {wptemp.DraftFilespec} -> {webpage.Filespec}");
         *          wptemp.DraftFilespec = webpage.DraftFilespec;
         *      }
         *      else
         *      {
         *          Console.WriteLine($"===> check {wptemp.DraftFilespec} -> {webpage.DraftFilespec}");
         *      }
         *  }
         *  if (webpage.Filespec != null && wptemp.Filespec != webpage.Filespec)
         *  {
         *      Console.WriteLine($"PutHost[Filespec] {wptemp.Filespec} -> {webpage.Filespec}");
         *      wptemp.Filespec = webpage.Filespec;
         *  }
         *  return wptemp;
         * }
         */

        public Task <int> SaveChangesAsync() => EfDomain.SaveChangesAsync();