Пример #1
0
        static void ConnectTest()
        {
            ConnectionDAL connDAL = new ConnectionDAL();

            Conn connData = new Conn();

            connData.DBType    = "SQLServer";
            connData.ConnStr   = "data source=(local);initial catalog=KBS;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework";
            connData.AliasName = "SQLTest";

            int result = connDAL.CreateConn(connData);

            Console.WriteLine("{0}", result.ToString());

            Console.WriteLine("----------------");
            Console.WriteLine("-----GETBYID----");
            if (result > 0)
            {
                Conn conn = connDAL.GetConnById(1);
                Console.WriteLine("CId={0}", conn.CId.ToString());
                Console.WriteLine("STR={0}", conn.ConnStr);
                Console.WriteLine("DBType={0}", conn.DBType);
            }
            Console.WriteLine("-------END-GETBYID---------");

            Console.WriteLine("-----GET----");
            if (result > 0)
            {
                var list = connDAL.GetConn();
                foreach (Conn item in list)
                {
                    Console.WriteLine("STR={0}", item.ConnStr);
                }
            }
            Console.WriteLine("-------END-GET---------");
        }