using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Smo.Wmi;
using System.Data.SqlClient;
namespace AccessOneRoundTrip
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.Error.WriteLine("useage: AccessOneRoundTrip <server> <urn>");
                return;
            }
            
            Server server = new Server(args[0]);
            server.ConnectionContext.SqlConnectionObject.StatisticsEnabled = true;
            SqlSmoObject sObj = server.GetSmoObject(args[1]);
            sObj.Initialize();
            System.Collections.IDictionary dict =
                server.ConnectionContext.SqlConnectionObject.RetrieveStatistics();
            foreach (Object o in dict.Keys)
            {
                Console.WriteLine(o.ToString() + ": " + dict[o]);
            }

        }
    }
}
