using System;
using System.Collections.Generic;
using System.Text;
using smo = Microsoft.SqlServer.Management.Smo;
using System.Reflection;



namespace MissingDatabaseProps
{
    class Program
    {
        static void Main(string[] args)
        {
            smo.Server server = new smo.Server();
            smo.Database database = server.Databases[0];
            Type databaseType = typeof(smo.Database);
           // Console.WriteLine(database.MirroringStatus); 
            //decimal d = database.MirroringFailoverLogSequenceNumber;

            foreach(smo.Property p in database.Properties)
            {
                try
                {
                    smo.Property p1 = database.Properties[p.Name];
                }
                catch(Exception e)
                {
                    Console.WriteLine(e.Message);
                    PropertyInfo pinfo = databaseType.GetProperty(p.Name);
                    if(pinfo != null)
                    {
                        Console.Write(p.Expensive + " ");
                        Object obj = pinfo.GetValue(database, new object[0]);
                        Console.WriteLine(p.Name + " " + obj);
                    }

                }

            }
        }
    }
}
