本文整理汇总了C#中IQuery.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IQuery.GetType方法的具体用法?C# IQuery.GetType怎么用?C# IQuery.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQuery
的用法示例。
在下文中一共展示了IQuery.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetQueryExecutor
/// <summary>
/// Returns a multi class query executor (polymorphic = true)
/// </summary>
public IQueryExecutor GetQueryExecutor(IQuery query, IStorageEngine engine)
{
if (query is ValuesCriteriaQuery)
return new MultiClassGenericQueryExecutor(new ValuesCriteriaQueryExecutor(query, engine));
if (query is SodaQuery)
return new MultiClassGenericQueryExecutor(new CriteriaQueryExecutor(query, engine));
throw new OdbRuntimeException(NDatabaseError.QueryTypeNotImplemented.AddParameter(query.GetType().FullName));
}
示例2: Validate
#pragma warning disable 1591 // Xml Comments
public QueryValidationResult Validate(IQuery query)
{
var brokenRules = new Dictionary<IRule, BrokenRule>();
var ruleContext = _ruleContexts.GetFor(query);
ruleContext.OnFailed(RuleFailed(ruleContext, brokenRules));
var hasDescriptor = _descriptors.CallGenericMethod<bool, IQueryValidationDescriptors>(d => d.HasDescriptorFor<IQuery>, query.GetType());
if (hasDescriptor)
{
var descriptor = _descriptors.CallGenericMethod<IQueryValidationDescriptor, IQueryValidationDescriptors>(d => d.GetDescriptorFor<IQuery>, query.GetType());
descriptor.ArgumentRules.ForEach(r => {
var value = r.Property.GetValue(query);
r.Evaluate(ruleContext, value);
});
}
var result = new QueryValidationResult(brokenRules.Values);
return result;
}
示例3: GetQueryPropertyFromQuery
PropertyInfo GetQueryPropertyFromQuery(IQuery query)
{
var property = query.GetType().GetProperty(QueryPropertyName, BindingFlags.Public | BindingFlags.Instance);
return property;
}
示例4: For
/// <summary>
/// Creates a <see cref="QueryResult"/> for a given <see cref="IQuery"/>
/// </summary>
/// <param name="query"><see cref="IQuery"/> to create for</param>
/// <returns><see cref="QueryResult"/> for the given <see cref="IQuery"/></returns>
public static QueryResult For(IQuery query)
{
var result = new QueryResult
{
QueryName = query.GetType().Name
};
return result;
}
示例5: NoQueryPropertyException
/// <summary>
/// Initializes a new instance of <see cref="NoQueryPropertyException"/>
/// </summary>
/// <param name="query"><see cref="IQuery"/> that does not have the property on it</param>
public NoQueryPropertyException(IQuery query)
: base(string.Format("No query property for {0}. Hint: It should be a public instance property with a get on it.", query.GetType().FullName))
{
}
示例6: UnknownQueryTypeException
/// <summary>
/// Initializes a new instance of <see cref="UnknownQueryTypeException"/>
/// </summary>
/// <param name="query"><see cref="IQuery"/> that does not have the property on it</param>
/// <param name="type"><see cref="Type"/> of the expected query returned from the Query property</param>
public UnknownQueryTypeException(IQuery query, Type type)
: base(string.Format("Unable to find a query provider of type '{0}' for the query '{1}'. Hint: Are you sure the query return type has a known query provider for it?", type.FullName, query.GetType().FullName))
{
}
示例7: QueryAndType
public QueryAndType(IQuery query)
{
Query = query;
Type = query.GetType();
}