本文整理汇总了C#中QueryToken.GetImplementations方法的典型用法代码示例。如果您正苦于以下问题:C# QueryToken.GetImplementations方法的具体用法?C# QueryToken.GetImplementations怎么用?C# QueryToken.GetImplementations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryToken
的用法示例。
在下文中一共展示了QueryToken.GetImplementations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromToken
internal static MetaExpression FromToken(QueryToken token, Type sourceType)
{
var pr = token.GetPropertyRoute();
if (pr == null)
return new MetaExpression(sourceType, new DirtyMeta(token.GetImplementations(), new Meta[0]));
if (!sourceType.IsLite() && pr.Type.IsLite())
return new MetaExpression(sourceType, new CleanMeta(token.GetImplementations(), new[] { pr.Add("Entity") }));
return new MetaExpression(sourceType, new CleanMeta(token.GetImplementations(), new[] { pr }));
//throw new InvalidOperationException("Impossible to convert {0} to {1}".FormatWith(pr.Type.TypeName(), sourceType.TypeName()));
}
示例2: GetValueControl
public static Control GetValueControl(QueryToken token, string bindingPath)
{
Type type = token.Type;
if (type.IsLite())
{
Implementations implementations = token.GetImplementations().Value;
Type cleanType = Lite.Extract(type);
if (EntityKindCache.IsLowPopulation(cleanType) && !implementations.IsByAll)
{
EntityCombo ec = new EntityCombo
{
Type = type,
Implementations = implementations,
};
ec.SetBinding(EntityCombo.EntityProperty, new Binding
{
Path = new PropertyPath(bindingPath),
NotifyOnValidationError = true,
ValidatesOnDataErrors = true,
ValidatesOnExceptions = true,
});
return ec;
}
else
{
EntityLine el = new EntityLine
{
Type = type,
Create = false,
Implementations = implementations,
};
el.SetBinding(EntityLine.EntityProperty, new Binding
{
Path = new PropertyPath(bindingPath),
NotifyOnValidationError = true,
ValidatesOnDataErrors = true,
ValidatesOnExceptions = true
});
return el;
}
}
else if (type.IsEmbeddedEntity())
{
EntityLine el = new EntityLine
{
Type = type,
Create = false,
Autocomplete = false,
Find = false,
Implementations = null,
};
el.SetBinding(EntityLine.EntityProperty, new Binding
{
Path = new PropertyPath(bindingPath),
NotifyOnValidationError = true,
ValidatesOnDataErrors = true,
ValidatesOnExceptions = true
});
return el;
}
else
{
ValueLine vl = new ValueLine()
{
Type = type,
Format = token.Format,
UnitText = token.Unit,
};
if (type.UnNullify().IsEnum)
{
vl.ItemSource = EnumEntity.GetValues(type.UnNullify()).PreAndNull(type.IsNullable()).ToObservableCollection();
}
vl.SetBinding(ValueLine.ValueProperty, new Binding
{
Path = new PropertyPath(bindingPath), //odd
NotifyOnValidationError = true,
ValidatesOnDataErrors = true,
ValidatesOnExceptions = true,
Converter = Reflector.IsNumber(type) ? Converters.Identity : null,
});
return vl;
}
}
示例3: QueryTokenTS
public QueryTokenTS(QueryToken qt, bool recursive)
{
this.toString = qt.ToString();
this.niceName = qt.NiceName();
this.key = qt.Key;
this.fullKey = qt.FullKey();
this.type = new TypeReferenceTS(qt.Type, qt.GetImplementations());
this.filterType = QueryUtils.TryGetFilterType(qt.Type);
this.format = qt.Format;
this.unit = qt.Unit;
this.typeColor = qt.TypeColor;
this.niceTypeName = qt.NiceTypeName;
this.queryTokenType = GetQueryTokenType(qt);
this.isGroupable = qt.IsGroupable;
this.propertyRoute = qt.GetPropertyRoute()?.ToString();
if (recursive && qt.Parent != null)
this.parent = new QueryTokenTS(qt.Parent, recursive);
}