本文整理汇总了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;
}
示例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;
}