Example #1
0
        private void WriteLocks(IDatabaseQuery database)
        {
            Console.WriteLine("LOCKS:");
            var info = database.Query <dynamic>("SELECT * FROM sys.lock_information;").ToList();

            foreach (var row in info)
            {
                Console.WriteLine(string.Format("> {0} {1} {2} {3} {4} {5} {6}", row.request_spid,
                                                row.resource_type, row.resource_description, row.request_mode, row.resource_table,
                                                row.resource_table_id, row.request_status));
            }
        }
Example #2
0
        private void WriteLocks(IDatabaseQuery database)
        {
            Console.WriteLine("LOCKS:");
            var info = database.Query <dynamic>("SELECT * FROM sys.dm_tran_locks;").ToList();
            var sb   = new StringBuilder("> ");

            foreach (var row in info)
            {
                if (row is IDictionary <string, object> values)
                {
                    sb.AppendJoin(", ", values);
                }
                sb.AppendLine(string.Empty);
            }
            Console.WriteLine(sb.ToString());
        }