示例#1
0
        private void connectionButton_Click(object sender, EventArgs e)
        {
            try
            {
                label1.Text = "Пробуем подключиться к серверу...";
                TGroupContext    tGroupContext    = new TGroupContext("DbConnection");
                TRelationContext tRelationContext = new TRelationContext("DbConnection");
                TPropertyContext tPropertyContext = new TPropertyContext("DbConnection");

                var tRelationEntity = tRelationContext.TRelationProperty;
                var tGroupEntity    = tGroupContext.TGroupProperty;
                var tPropertyEntity = tPropertyContext.TPropertyProperty;

                foreach (TPropertyClass g in tPropertyEntity)
                {
                    Console.WriteLine("{0} {1} {2} {3}", g.id, g.name, g.value, g.group_id);
                }


                foreach (TGroupClass g in tGroupEntity)
                {
                    Console.WriteLine("{0} {1}", g.id, g.name);
                }

                foreach (TRelationClass g in tRelationEntity)
                {
                    Console.WriteLine("{0} {1}", g.idPparent, g.idChild);
                }
                label1.Text = "Подключение прошло успешно!";
            }
            catch (Exception ex) { Console.WriteLine(ex.Message); label1.Text = "Не удалось подключиться. Проверьте, правильно ли указано имя подключения."; }
        }
示例#2
0
        public Core_Entity()
        {
            tGroupContext     = new TGroupContext("DbConnection");
            tGroupEntities    = tGroupContext.TGroupProperty;
            tPropertyContext  = new TPropertyContext("DbConnection");
            tPropertyEntities = tPropertyContext.TPropertyProperty;
            tRelationContext  = new TRelationContext("DbConnection");
            tRelationEntities = tRelationContext.TRelationProperty;

            InitializeComponent();
            this.InitRootGroup();
        }