本文整理汇总了C#中Value.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# Value.Accept方法的具体用法?C# Value.Accept怎么用?C# Value.Accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Value
的用法示例。
在下文中一共展示了Value.Accept方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override void Visit(Call call)
{
if (call.Name == "id")
{
Table table = (Table)tableContext.Peek();
EntityMapping em = (EntityMapping)entityMappingContext.Peek();
if (em.Ids.Count == 1)
{
Column opRight = new Column(em.Ids[0], table.TableAlias, em.GetIdField(em.Ids[0]));
InPredicate ip = new InPredicate(opRight);
DbType type = DbType.Object;
if (em.Ids[0].Generator.Name == GeneratorMapping.GeneratorType.guid)
type = DbType.AnsiString;
else
{
// If generator is inherited => Get the parameters of the parent type
EntityMapping parentEM = em;
if (em.Ids[0].Generator.Name == GeneratorMapping.GeneratorType.inherited)
{
Evaluant.Uss.Models.Entity current = Model.GetEntity(em.Type);
while (Model.GetParent(current) != null)
{
current = Model.GetParent(current);
parentEM = _Mapping.Entities[current.Type];
if (parentEM.Ids[0].Generator.Name != GeneratorMapping.GeneratorType.inherited)
{
parentEM.Ids[0].Generator.Params = _Mapping.Entities[current.Type].Ids[0].Generator.Params;
break;
}
}
}
if (parentEM.Ids[0].Generator.Name == GeneratorMapping.GeneratorType.guid)
type = DbType.AnsiString;
else
type = (DbType)Enum.Parse(typeof(DbType), parentEM.Ids[0].Generator.GetParam(DBDialect.DBTYPE).Value);
}
foreach (Evaluant.OPath.Expressions.Constraint constraint in call.Operands)
{
if ((constraint as Value) != null)
{
if (((Value)constraint).Text == string.Empty)
{
((Value)constraint).Text = null;
((Value)constraint).Type = GetValueEnum(type);
}
}
constraint.Accept(this);
if (((Constant)sqlExpressionContext.Peek()).Value == null)
{
sqlExpressionContext.Pop();
sqlExpressionContext.Push(new Constant(DBNull.Value, type));
}
ip.SubQueries.Add(new Constant(((Constant)sqlExpressionContext.Pop()).Value, type));
}
sqlExpressionContext.Push(ip);
}
else
{
// TODO : Logique des clés primaires
for (int indexConstraint = 0; indexConstraint < call.Operands.Count; indexConstraint++)
{
Evaluant.OPath.Expressions.Constraint constraint = call.Operands[indexConstraint];
for (int i = 0; i < em.Ids.Count; i++)
{
PrimaryKeyMapping pkm = em.Ids[i];
DbType dbType = _Dialect.GetDbTypeToPrimaryKey(pkm.Generator);
Value value = constraint as Value;
if ((constraint as Value) != null)
{
if (value.Text == string.Empty)
{
value.Text = null;
value.Type = GetValueEnum(dbType);
}
}
string[] values = value.Text.Split(SqlMapperProvider.IDSEP);
if (i >= values.Length)
break;
Value newValue = new Value(values[i], GetValueEnum(_Dialect.GetDbTypeToPrimaryKey(pkm.Generator)));
newValue.Accept(this);
if (((Constant)sqlExpressionContext.Peek()).Value == null)
{
sqlExpressionContext.Pop();
sqlExpressionContext.Push(new Constant(DBNull.Value, dbType));
//.........这里部分代码省略.........