Exemple #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         if (builder != null)
         {
             builder.Clear();
             builder = null;
         }
         if (linq != null)
         {
             linq.Dispose();
             linq = null;
         }
         if (Host != null)
         {
             Host = null;
         }
     }
     disposed = true;
 }
Exemple #2
0
        public void Init()
        {
            builder = new SqlConnectionStringBuilder(Host.ConnectionString);
            linq    = new SomeLinqDataContext(builder.ConnectionString)
            {
                CommandTimeout = Host.ConnectionTimeout
            };
            var v = linq.SecuritySystemUsers
                    .Where(w => w.UserName == user && w.GCRecord == null)
                    .Select(s => s)
                    .FirstOrDefault();

            if (v == null || v.Компьютер == machine)
            {
                linq.Dispose();
                return;
            }
            v.Компьютер = machine;
            linq.SubmitChanges();
            linq.Dispose();
        }