本文整理汇总了C#中ISqlDialect.ParseColumnName方法的典型用法代码示例。如果您正苦于以下问题:C# ISqlDialect.ParseColumnName方法的具体用法?C# ISqlDialect.ParseColumnName怎么用?C# ISqlDialect.ParseColumnName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISqlDialect
的用法示例。
在下文中一共展示了ISqlDialect.ParseColumnName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMemberColumnName
internal static string GetMemberColumnName(MemberInfo p, ISqlDialect dialect)
{
string retVal = p.Name;
// Get Column Name to Use
var columnAttribute = p.GetCustomAttributes(typeof(SQLinqColumnAttribute), false).FirstOrDefault() as SQLinqColumnAttribute;
if (columnAttribute != null)
{
if (!string.IsNullOrEmpty(columnAttribute.Column))
{
// Column name explicitly set, use that instead
retVal = columnAttribute.Column;
}
}
return dialect.ParseColumnName(retVal);
}
示例2: ProcessSelector
//private string ProcessExpression(Expression expression, IDictionary<string, object> parameters)
//{
// return ProcessExpression(expression, expression, parameters, this.GetParameterName);
//}
#endregion
#region Private Static Methods
static void ProcessSelector(ISqlDialect dialect, Expression rootExpression, Expression e, IList<string> select, IDictionary<string, object> parameters, Func<string> getParameterName)
{
if (e == null)
{
//// Join
//if (this.JoinExpressions.Count > 0)
//{
// this.ProcessSelector(this.JoinExpressions[0].ResultSelector, select, parameters);
// return;
//}
// All
//select.Add("*");
return;
}
if (e.NodeType == ExpressionType.Lambda)
{
ProcessSelector(dialect, rootExpression, ((LambdaExpression)e).Body, select, parameters, getParameterName);
}
else if (e.NodeType == ExpressionType.New)
{
var n = (NewExpression)e;
var len = n.Members.Count();
for (var i = 0; i < len; i++)
{
var arg = n.Arguments[i];
var field = ProcessExpression(dialect, rootExpression, arg, parameters, getParameterName);
var alias = dialect.ParseColumnName(n.Members[i].Name);
if (field == alias)
{
select.Add(field);
}
else
{
select.Add(string.Format("{0} AS {1}", field, alias));
}
}
}
else if (e.NodeType == ExpressionType.Convert)
{
var u = (UnaryExpression)e;
select.Add(ProcessExpression(dialect, rootExpression, u.Operand, parameters, getParameterName));
}
else if (e.NodeType == ExpressionType.MemberAccess)
{
var s = ProcessSingleSideExpression(dialect, rootExpression, e, parameters, getParameterName);
select.Add(s);
}
else if (e.NodeType == ExpressionType.Call)
{
var s = ProcessCallExpression(dialect, rootExpression, (MethodCallExpression)e, parameters, getParameterName);
select.Add(s);
}
}