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


C# IEntityPersister.GetParameter方法代码示例

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


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

示例1: CreateDataCountSql

 public static CmdParameter CreateDataCountSql(ISessionImplementor session, IEntityPersister entityPersister, Criteria criteria)
 {
     var classMetadata = entityPersister.ClassMetadata;
     var result = new CmdParameter();
     var parameters = new List<DbParameter>();
     var sql = new StringBuilder();
     sql.AppendFormat("SELECT COUNT(1) FROM {0} ", classMetadata.TableName);
     if (criteria != null && criteria.CriterionList != null && criteria.CriterionList.Count > 0)
     {
         criteria.Driver = entityPersister.Driver;
         criteria.DicParameter = entityPersister.GetParameter(session);
         criteria.DbParameter = parameters;
         sql.Append(" WHERE ").Append(criteria.ToString(classMetadata));
         result.Parameters = parameters.ToArray();
     }
     sql.Append(entityPersister.Driver.MultipleQueriesSeparator);
     result.CommandText = sql.ToString();
     log.Info(sql);
     return result;
 }
开发者ID:eicrosoft,项目名称:VipSoft,代码行数:20,代码来源:Map.cs

示例2: CreateSelectSql2

        public static CmdParameter CreateSelectSql2(ISessionImplementor session, IEntityPersister entityPersister, Criteria criteria, Order order)
        {
            var classMetadata = entityPersister.ClassMetadata;
            var result = new CmdParameter();

            //if (string.IsNullOrEmpty(obj.Conditaion))
            //{
            //    var columnInfo = classMetadata.ColumnInfos.Find(t => t.IsPrimaryKey);
            //    if (columnInfo != null)
            //    {
            //        var v = columnInfo.PropertyInfo.FastGetValue(obj);
            //        if (!IsNull(v)) result = CreateSelectSql(session, entityPersister, v);
            //    }

            //}
            var parameters = new List<DbParameter>();
            //entityPersister.Driver.FormatNameForSql(columnInfo.Name)

            // string rConditaion = GetConditaion(session, entityPersister, obj, out parameters);

            var sql = new StringBuilder("SELECT ");
            //sql.Append(string.IsNullOrEmpty(obj.ResultColumns) ? "*" : obj.ResultColumns);
            sql.Append("*");
            sql.AppendFormat(" FROM {0} ", classMetadata.TableName);
            if (criteria != null && criteria.CriterionList != null && criteria.CriterionList.Count > 0)
            {
                criteria.Driver = entityPersister.Driver;
                criteria.DicParameter = entityPersister.GetParameter(session);
                criteria.DbParameter = parameters;
                sql.Append(" WHERE ").Append(criteria.ToString(classMetadata));
                result.Parameters = parameters.ToArray();
            }
            // entityPersister.SetDbParamter(session, parameters, columnInfo.Name, value);
            //var where = GetWhereCaluse(rConditaion);
            //if (where.Length > 0)
            //{
            //    sql.AppendFormat(" WHERE {0} ", where);
            //    result.Parameters = parameters.ToArray();
            //}
            //sql.Append(obj.OrderBy ?? "" );
            sql.Append(order != null ? order.ToString(classMetadata) : "");
            sql.Append(entityPersister.Driver.MultipleQueriesSeparator);
            result.CommandText = sql.ToString();
            log.Info(sql);
            return result;
        }
开发者ID:eicrosoft,项目名称:VipSoft,代码行数:46,代码来源:Map.cs


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