本文整理汇总了C#中IQueryBuilder类的典型用法代码示例。如果您正苦于以下问题:C# IQueryBuilder类的具体用法?C# IQueryBuilder怎么用?C# IQueryBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IQueryBuilder类属于命名空间,在下文中一共展示了IQueryBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericQueryPart
/// <summary>
/// Creates a generic query part that can be used for any query
/// </summary>
/// <param name="prefix"></param>
/// <param name="parameters"></param>
/// <param name="builder">The type of building object</param>
public GenericQueryPart(string prefix, IEnumerable<IQueryParameter> parameters, IQueryBuilder builder)
{
_builder = builder;
Debug.Assert(prefix != null, "prefix != null");
Prefix = prefix;
QueryParameters = parameters;
}
示例2: GetStationCollectionAsync
public static void GetStationCollectionAsync(IQueryBuilder url, RealTimeDataDelegate callback)
{
try
{
if (url == null) throw new Exception("Cannot work with null-objects");
if (String.IsNullOrEmpty(url.Url)) throw new Exception("Url cannot be empty");
var client = new WebClient();
client.DownloadStringCompleted += (s, e) =>
{
if (e.Error != null) throw e.Error;
if (e.Result == null) return;
var collection = JsonHelper.Deserialize<
IList<Station>>(e.Result);
callback(new ObservableCollection<Station>(collection));
};
client.DownloadStringAsync(new Uri(url.Url));
}
catch (Exception)
{
throw;
}
}
示例3: FurnitureCreator
public FurnitureCreator(
IRoomReader roomReader,
IQueryBuilder queryBuilder)
{
this.roomReader = roomReader;
this.queryBuilder = queryBuilder;
}
示例4: ExecuteReaderAndRead
public static void ExecuteReaderAndRead( this IDbTransaction dbTransaction, IQueryBuilder query, Action<IDataReader> action )
{
ExecuteReader( dbTransaction,
query.GetSql(),
query.GetParameters(),
dataReader => dataReader.Read( action ) );
}
示例5: CreateQuery
/// <summary>
/// Creates the query for this class.
/// </summary>
/// <param name="qb">The <see cref="IQueryBuilder"/> instance.</param>
/// <returns>The query for this class.</returns>
static string CreateQuery(IQueryBuilder qb)
{
// SELECT * FROM `{0}`
var q = qb.Select(GuildTable.TableName).AllColumns();
return q.ToString();
}
示例6: Load
private static IList<Status> Load(IQueryBuilder queryBuilder, ulong maxId, int count = 2000)
{
var statuses = new List<Status>();
//todo limit exception System.AggregateException, message: Rate limit exceeded - Please visit the LINQ to Twitter FAQ (at the HelpLink) for help on resolving this error.
var tweetQuery = queryBuilder.BuildTaskByMinId(maxId + 1).ToList();
statuses.AddRange(tweetQuery);
if (statuses.Count < 150)
{
return statuses;
}
while (statuses.Count < count)
{
tweetQuery = queryBuilder.BuildTaskByMinIdAndMaxId(maxId + 1, statuses[statuses.Count - 1].StatusID - 1).ToList();
statuses.AddRange(tweetQuery);
if (tweetQuery.Count < 150)
{
break;
}
}
return statuses;
}
示例7: CreateQuery
/// <summary>
/// Creates the query for this class.
/// </summary>
/// <param name="qb">The <see cref="IQueryBuilder"/> instance.</param>
/// <returns>The query for this class.</returns>
static string CreateQuery(IQueryBuilder qb)
{
// SELECT `id` FROM `{0}`
var q = qb.Select(QuestTable.TableName).Add("id");
return q.ToString();
}
示例8: BuildQual
public virtual string BuildQual(IQueryBuilder builder)
{
if (!builder.StatusClauseAdded)
{
// builder
}
var set = builder.StoredClauses;
var clauses = this.ExecuteStoredClauses(set).Distinct(new ClauseComparer()).ToList();
var qual = new StringBuilder();
foreach (var clause in clauses)
{
if (string.IsNullOrEmpty(qual.ToString()))
{
qual.Append(clause.Value ?? string.Empty);
}
else
{
qual.Append(string.Format("{0} {1} ", clause.Operator == ClauseOperator.AND ? " AND" : " OR", clause.Value ?? string.Empty));
}
}
return qual.ToString();
}
示例9: CreateQuery
/// <summary>
/// Creates the query for this class.
/// </summary>
/// <param name="qb">The <see cref="IQueryBuilder"/> instance.</param>
/// <returns>The query for this class.</returns>
static string CreateQuery(IQueryBuilder qb)
{
// CALL find_foreign_keys(@schema,@table,@column)
var q = qb.CallProcedure("find_foreign_keys").AddParam(SchemaParameterName, TableParameterName, ColumnParameterName);
return q.ToString();
}
示例10: MusicModule
public MusicModule(IQueryBuilder queryBuilder, ICommandBuilder commandBuilder)
: base("/music")
{
_queryBuilder = queryBuilder;
_commandBuilder = commandBuilder;
Get["/"] = _ =>
{
this.RequiresAuthentication();
this.RequiresReadClaim("music");
var paging = this.BindAndValidate<Paging>();
var result = _queryBuilder.For<IPagedEnumerable<TrackDto>>().With(paging);
return Response.AsAccepted(result, new[] { "json", "m3u" }, model => Response.AsJson(model));
};
Post["/"] = _ =>
{
this.RequiresAuthentication();
this.RequiresWriteClaim("music");
var model = this.BindAndValidate<AddTrack>();
_commandBuilder.Execute(model);
return new Response
{
StatusCode = HttpStatusCode.Created
};
};
Post["/tagged"] = _ =>
{
this.RequiresAuthentication();
this.RequiresWriteClaim("music");
var model = this.BindAndValidate<MarkTrackWithTags>();
_commandBuilder.Execute(model);
return new Response
{
StatusCode = HttpStatusCode.OK
};
};
Delete["/tagged"] = _ =>
{
this.RequiresAuthentication();
this.RequiresWriteClaim("music");
var model = this.BindAndValidate<RemoreTagsFromTrack>();
_commandBuilder.Execute(model);
return new Response
{
StatusCode = HttpStatusCode.OK
};
};
}
示例11: RootExecuteReader
private static void RootExecuteReader( this IDbConnection dbConnection, IQueryBuilder queryBuilder, Action<IDataReader> action )
{
using ( IDbCommand dbCommand = dbConnection.CreateCommand( queryBuilder ) )
using ( IDataReader dataReader = dbCommand.ExecuteReader() )
{
action( dataReader );
}
}
示例12: SelectRequest
public SelectRequest(SolrUriBuilder builder, IQueryBuilder queryBuilder)
: base(builder)
{
UrlBuilder.Handler = "select";
if (queryBuilder == null)
throw new ArgumentNullException("queryBuilder");
UrlBuilder.SetQuery(queryBuilder);
}
示例13: CreateQuery
/// <summary>
/// Creates the query for this class.
/// </summary>
/// <param name="qb">The <see cref="IQueryBuilder"/> instance.</param>
/// <returns>The query for this class.</returns>
static string CreateQuery(IQueryBuilder qb)
{
// UPDATE `{0}` SET `server_time`=NOW()
var f = qb.Functions;
var q = qb.Update(ServerTimeTable.TableName).Add("server_time", f.Now());
return q.ToString();
}
示例14: CalcService
public CalcService()
{
InitializeComponent();
IoC.Init();
_query = IoC.Resolve<IQueryBuilder>();
_periodsRepository = IoC.Resolve<IRepository<Period>>();
_statisticDataRepository = IoC.Resolve<IRepository<StatisticalData>>();
_dynamicDataRepository = IoC.Resolve<IRepository<DynamicData>>();
_unitOfWorkFactory = IoC.Resolve<IUnitOfWorkFactory>();
}
示例15: CreateQuery
/// <summary>
/// Creates the query for this class.
/// </summary>
/// <param name="qb">The <see cref="IQueryBuilder"/> instance.</param>
/// <returns>The query for this class.</returns>
static string CreateQuery(IQueryBuilder qb)
{
// SELECT `id` FROM `{0}` WHERE `repeatable` = 1
var f = qb.Functions;
var s = qb.Settings;
var q = qb.Select(QuestTable.TableName).Add("id")
.Where(f.Equals(s.EscapeColumn("repeatable"), "1"));
return q.ToString();
}