当前位置: 首页>>代码示例>>C#>>正文


C# Session.ExecuteQuery方法代码示例

本文整理汇总了C#中Session.ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Session.ExecuteQuery方法的具体用法?C# Session.ExecuteQuery怎么用?C# Session.ExecuteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.ExecuteQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryCompiler_Assert_PreCompiledQuery_Parameter_Value_Changes

        public void QueryCompiler_Assert_PreCompiledQuery_Parameter_Value_Changes()
        {
            // basic precompiled query.
            IQueryCompilerLevel2<Employee> query = Select.All.From<Employee>()
                .Where(e => e.EmployeeId > Param.Get<int>());

            using (var session = new Session())
            {
                Assert.That(session.ExecuteQuery(query, 1).Count(), Is.EqualTo(8));
                Assert.That(session.ExecuteQuery(query, 2).Count(), Is.EqualTo(7));
            }
        }
开发者ID:stalinvr007,项目名称:VoDB,代码行数:12,代码来源:Query_Tests.cs

示例2: QueryCompiler_Assert_PreCompiledQuery_Parameters_SetBy_IEnumerable

        public void QueryCompiler_Assert_PreCompiledQuery_Parameters_SetBy_IEnumerable()
        {
            // basic precompiled query.
            IQueryCompilerLevel2<Employee> query = Select.All.From<Employee>()
                .Where(e => e.EmployeeId > Param.Get<int>())
                .And(e => e.EmployeeId < Param.Get<int>());

            using (var session = new Session())
            {
                Assert.That(session.ExecuteQuery(query, new[] { 1, 8 }).Count(), Is.EqualTo(6));
                Assert.That(session.ExecuteQuery(query, 1, 8).Count(), Is.EqualTo(6));
            }
        }
开发者ID:stalinvr007,项目名称:VoDB,代码行数:13,代码来源:Query_Tests.cs

示例3: GetNavIdByName

 /// <summary>
 /// 根据导航名称获取导航序号
 /// </summary>
 /// <param name="session"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 private long GetNavIdByName(Session session, string name)
 {
     var assignmentSql = string.Format(@"INSERT IGNORE INTO `nav_name_dicts`(`name`) VALUES('{0}'); SELECT `id` FROM `nav_name_dicts` WHERE `name` = '{0}';", name);
     var ids = session.ExecuteQuery<long>(assignmentSql);
     if (ids.Count == 0)
     {
         throw new Exception(string.Format("注册导航名称{0}失败", name));
     }
     if (ids.Count != 1)
     {
         throw new Exception(string.Format("导航名称 {0} 重复", name));
     }
     return ids[0];
 }
开发者ID:dalinhuang,项目名称:info_platform_i,代码行数:20,代码来源:SystemActivity.cs

示例4: CreateNewRowTimekeeping

        private void CreateNewRowTimekeeping(Session session, string value,
            Guid loaiDuLieuChamCongOid, Guid tenBangChamCongOid, Guid nhanVienOid, Guid PhongBanOid, int index, ref List<string> strArr)
        {
            string s = string.Format("SELECT * FROM \"TimekeepingMonth\" WHERE" +
                    "\"TimekeepingName\" = '{0}' AND \"Employee\" = '{1}' AND \"DataTypeTimekeeping\" = '{2}'",
                tenBangChamCongOid, nhanVienOid, loaiDuLieuChamCongOid);
            SelectedData data = session.ExecuteQuery(s);
            //if(session.FindObject<TimekeepingMonth>(CriteriaOperator.And(new BinaryOperator("TimekeepingName.Oid", tenBangChamCongOid),
            //    new BinaryOperator("Employee.Oid",nhanVienOid), new BinaryOperator("DataTypeTimekeeping.Oid",loaiDuLieuChamCongOid))) == null)
            if(data.ResultSet[0].Rows.Length == 0)
            {
                session.BeginTransaction();
                Guid id = Guid.NewGuid();
                while (true)
                {
                    try
                    {

                        s = string.Format("INSERT INTO \"TimekeepingMonth\" (\"Oid\",\"TimekeepingName\", \"Employee\", \"Department\", \"DataTypeTimekeeping\", \"Ngay" + index.ToString() + "\")" +
                        "VALUES ('{4}','{0}','{1}','{2}','{3}')", tenBangChamCongOid, nhanVienOid, PhongBanOid, loaiDuLieuChamCongOid, value, id);
                        session.ExecuteNonQuery(s);
                        break;
                    }
                    catch
                    {
                        id = Guid.NewGuid();
                    }
                }
                session.CommitTransaction();
            }
            else
            {
                strArr.Add(string.Format("UPDATE \"TimekeepingMonth\" SET \"Ngay" + index.ToString() + "\" = '{3}', \"Department\" = '{4}', \"OptimisticLockField\" = null, \"GCRecord\" = null WHERE " +
                    "\"TimekeepingName\" = '{0}' AND \"Employee\" = '{1}' AND \"DataTypeTimekeeping\" = '{2}'",
                tenBangChamCongOid, nhanVienOid, loaiDuLieuChamCongOid, value,PhongBanOid));
            }
        }
开发者ID:phuonguit2015,项目名称:EasyHRM,代码行数:37,代码来源:TimekeepingViewController.cs


注:本文中的Session.ExecuteQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。