public void TestInsertOperationWithAttributeTableHana()
        {
            var hanaConnection = System.Data.Common.DbProviderFactories.GetFactory("Sap.Data.Hana").CreateConnection();

            hanaConnection.ConnectionString = ConfigurationManager.ConnectionStrings["hana"].ConnectionString;
            hanaConnection.Open();
            var trans = hanaConnection.BeginTransaction();

            using (var conn = hanaConnection)
            {
                IScriptBuilder builder = new ScriptHanaBuilder();

                var user = new UserSystem()
                {
                    Name = "Moisés", Email = "*****@*****.**", LoginName = "mosheh"
                };

                var createTableScript = builder.GetCreateTableCommand <UserSystem>();
                builder.Execute(createTableScript, conn);

                var lastId = conn.InsertReturningId <UserSystem>(user);
                Assert.AreEqual(1, lastId);

                trans.Rollback();
                builder.Execute("drop table \"IV_MD_SystemUser\"", hanaConnection);
            }
        }
        public void TestInsertOperationHana()
        {
            var hanaConnection = System.Data.Common.DbProviderFactories.GetFactory("Sap.Data.Hana").CreateConnection();

            hanaConnection.ConnectionString = ConfigurationManager.ConnectionStrings["hana"].ConnectionString;
            hanaConnection.Open();
            var trans = hanaConnection.BeginTransaction();

            using (var conn = hanaConnection)
            {
                IScriptBuilder builder = new ScriptHanaBuilder();

                var cliente = new Cliente()
                {
                    Id = 1, Nome = "Moisés", Ativo = true
                };

                var createTableScript = builder.GetCreateTableCommand <Cliente>();
                builder.Execute(createTableScript, conn);

                var lastId = conn.InsertReturningId <Cliente>(cliente);
                Assert.AreEqual(1, lastId);

                trans.Rollback();
                builder.Execute("drop table \"Cliente\"", hanaConnection);
            }
        }
        public void TestSelectOperationHana()
        {
            var hanaConnection = System.Data.Common.DbProviderFactories.GetFactory("Sap.Data.Hana").CreateConnection();

            hanaConnection.ConnectionString = ConfigurationManager.ConnectionStrings["hana"].ConnectionString;
            hanaConnection.Open();
            var trans = hanaConnection.BeginTransaction();

            using (var conn = hanaConnection)
            {
                IScriptBuilder builder = new ScriptHanaBuilder();

                var cliente = new Cliente()
                {
                    Id = 1, Nome = "Moisés", Ativo = true
                };
                var cliente2 = new Cliente()
                {
                    Id = 2, Nome = "José", Ativo = true
                };

                var createTableScript = builder.GetCreateTableCommand <Cliente>();
                var insertScript1     = builder.GetInsertCommand <Cliente>(cliente);
                var insertScript2     = builder.GetInsertCommand <Cliente>(cliente2);
                builder.Execute(createTableScript, conn);
                builder.Execute(insertScript1, conn);
                builder.Execute(insertScript2, conn);

                var clientes = conn.GetAll <Cliente>();
                Assert.AreEqual(2, clientes.Count());
                Assert.AreEqual("Moisés", clientes.ToList()[0].Nome);
                Assert.AreEqual("José", clientes.ToList()[1].Nome);

                trans.Rollback();
                builder.Execute("drop table \"Cliente\"", hanaConnection);
            }
        }