using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using smo = Microsoft.SqlServer.Management.Smo;
namespace DynamicProperties
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            this.Font = new Font(this.Font.FontFamily, 12);
            InitializeComponent();
        }
        private void FillPropertyList(smo.SqlSmoObject sso)
        {
            Properties.Items.Clear();
            foreach (smo.Property property in sso.Properties)
            {
                String name = property.Name;
                try
                {
                    Properties.Items.Add(
                        property.Name + " = " +
                        property.Value);

                }
                catch (Exception e)
                {
                    System.Diagnostics.Trace.WriteLine(e.Message);
                }
            }
        }
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            smo.Server local = new smo.Server();
            smo.Database AW = local.Databases[0];
            AW.Initialize(true);
            FillPropertyList(AW);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            Properties.Items.Clear();
            smo.Server local = new smo.Server();
            smo.Database AW = local.Databases[0];
            smo.Table customers = AW.Tables[0];
            customers.Initialize(true);
            FillPropertyList(customers);
        }
    }
    class MissingProperties
    {
        String property;
        internal MissingProperties(String property)
        {
            this.property = property;
        }
        internal bool SkipMe(String property)
        {
            return this.property == property;
        }
    }





}