예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            db = new AcademyEntities();

            listBox1.Show();

            var metadata = ((IObjectContextAdapter)(DbContext)db).ObjectContext.MetadataWorkspace;
            var tables   = metadata.GetItemCollection(DataSpace.SSpace)
                           .GetItems <EntityContainer>()
                           .Single()
                           .BaseEntitySets
                           .OfType <EntitySet>()
                           .Where(s => !s.MetadataProperties.Contains("Type") ||
                                  s.MetadataProperties["Type"].ToString() == "Tables");

            listBox1.DataSource = tables.ToList();
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();

            label1.Hide();
            listBox1.Hide();
            CreateButton.Hide();
            UpdateButton.Hide();
            DeleteButton.Hide();

            db = new AcademyEntities();

            /*db.Curators.Load();
             *
             * dataGridView1.DataSource = db.Curators.Local.ToBindingList();*/


            /*  var tableNames = db.MetadataWorkspace.GetItems(DataSpace.SSpace)
             *            .Select(t => t.Name)
             *            .ToList();
             * DbSet dbSet = db.;*/
        }