本文整理汇总了C#中ICommandBuilder类的典型用法代码示例。如果您正苦于以下问题:C# ICommandBuilder类的具体用法?C# ICommandBuilder怎么用?C# ICommandBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICommandBuilder类属于命名空间,在下文中一共展示了ICommandBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLinks
private IEnumerable<Gnosis.ILink> GetLinks(ICommandBuilder builder)
{
IDbConnection connection = null;
var links = new List<Gnosis.ILink>();
try
{
connection = GetConnection();
var command = builder.ToCommand(connection);
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var link = ReadLink(reader);
links.Add(link);
}
}
return links;
}
finally
{
if (defaultConnection == null && connection != null)
connection.Close();
}
}
示例2: GetMedia
private IEnumerable<IMedia> GetMedia(ICommandBuilder builder)
{
IDbConnection connection = null;
var media = new List<IMedia>();
try
{
connection = GetConnection();
var command = builder.ToCommand(connection);
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var medium = ReadMedium(reader);
media.Add(medium);
}
}
return media;
}
finally
{
if (defaultConnection == null && connection != null)
connection.Close();
}
}
示例3: ExecuteQuery
private IEnumerable<IDictionary<string, object>> ExecuteQuery(ICommandBuilder commandBuilder)
{
var connection = _connection ?? _adapter.CreateConnection();
var command = commandBuilder.GetCommand(connection);
command.Transaction = _transaction;
return TryExecuteQuery(command);
}
示例4: GetTags
private IEnumerable<Gnosis.ITag> GetTags(ICommandBuilder builder)
{
IDbConnection connection = null;
var tags = new List<Gnosis.ITag>();
try
{
connection = GetConnection();
var command = builder.ToCommand(connection);
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var tag = ReadTag(reader);
tags.Add(tag);
}
}
return tags;
}
finally
{
if (defaultConnection == null && connection != null)
connection.Close();
}
}
示例5: ExecuteScalar
private object ExecuteScalar(ICommandBuilder commandBuilder)
{
var connection = _connection ?? _adapter.CreateConnection();
var command = commandBuilder.GetCommand(connection);
command.Transaction = _transaction;
return TryExecuteScalar(command);
}
示例6: 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
};
};
}
示例7: CommandInterpreter
public CommandInterpreter(ICommandBuilder producer, IScene scene, TextReader reader)
: this(producer, scene)
{
if (reader != null)
{
Console.SetIn(reader);
}
}
示例8: AutoUpdaterCommandCreator
public AutoUpdaterCommandCreator(ICheckTimer checkTimer, IConfigurationConverter configurationConverter, ICommandBuilder commandBuilder,
INowGetter nowGetter, ILogger logger)
{
_checkTimer = checkTimer;
_configurationConverter = configurationConverter;
_commandBuilder = commandBuilder;
_nowGetter = nowGetter;
_logger = logger;
}
示例9: CommandEndpoint
public CommandEndpoint(ICommandBuilder commandBuilder, Configuration.IProvider configurationProvider)
{
_commandBuilder = commandBuilder;
_settings = configurationProvider.GetSettings();
_instructionNumber = new InstructionNumber();
_ipAddress = string.IsNullOrWhiteSpace(_settings.LocalIpAddress)
? Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork)
: IPAddress.Parse(_settings.LocalIpAddress);
}
示例10: AccountModule
public AccountModule(ICommandBuilder commandBuilder, IQueryBuilder queryBuilder)
: base("/account")
{
_commandBuilder = commandBuilder;
_queryBuilder = queryBuilder;
Get["/"] = _ =>
{
this.RequiresAuthentication();
this.RequiresReadClaim("account");
var paging = this.BindAndValidate<Paging>();
var result = _queryBuilder.For<IPagedEnumerable<UserDto>>().With(paging);
return Response.AsJson(result);
};
Post["/"] = _ =>
{
this.RequiresAuthentication();
this.RequiresWriteClaim("account");
var findByEmail = this.BindAndValidate<FindByEmail>();
var emailAlreadyInUse = _queryBuilder.For<UserDto>().With(findByEmail) != null;
if (emailAlreadyInUse)
{
return new Response
{
StatusCode = HttpStatusCode.BadRequest
};
}
var user = this.BindAndValidate<CreateUser>();
_commandBuilder.Execute(user);
return new Response
{
StatusCode = HttpStatusCode.Created
};
};
Post["/{email}"] = _ =>
{
this.RequiresAuthentication();
this.RequiresReadClaim("account");
var credentials = this.BindAndValidate<Credentials>();
var result = _queryBuilder.For<UserDto>().With(credentials);
return Response.AsJson(result);
};
}
示例11: GetJoinClauses
public IEnumerable<string> GetJoinClauses(IEnumerable<JoinClause> joins, ICommandBuilder commandBuilder)
{
var expressionFormatter = new ExpressionFormatter(commandBuilder, _schema);
foreach (var join in joins)
{
var builder = new StringBuilder(JoinKeyword);
builder.AppendFormat(" JOIN {0}{1} ON ({2})",
_schema.FindTable(_schema.BuildObjectName(join.Table.ToString())).QualifiedName,
string.IsNullOrWhiteSpace(join.Table.GetAlias()) ? string.Empty : " " + _schema.QuoteObjectName(join.Table.GetAlias()),
expressionFormatter.Format(join.JoinExpression));
yield return builder.ToString().Trim();
}
}
示例12: Filter
public static void Filter(ref StringBuilder sqlBuilder,string field, ICommandBuilder builder)
{
if (OracleKeyWords.Exsit(field))
{
sqlBuilder.AppendFormat("{0}{1}{2}"
, builder.ObjectNamePrefix
, field
, builder.ObjectNameSuffix
);
}
else {
sqlBuilder.Append(field);
}
}
示例13: Get_UsingBuilderFactory_ShouldReturnCorrectValue
public void Get_UsingBuilderFactory_ShouldReturnCorrectValue(
string name,
ISchedulers schedulers,
ICommandBuilder expected)
{
//arrange
var sut = new CommandBuilderProvider(schedulers, (action, schedulers1, arg3) => expected);
//act
var actual = sut.Get(name);
//assert
actual.Should().Be(expected);
}
示例14: ExpressionFormatter
public ExpressionFormatter(ICommandBuilder commandBuilder, DatabaseSchema schema)
{
_commandBuilder = commandBuilder;
_schema = schema;
_expressionFormatters = new Dictionary<SimpleExpressionType, Func<SimpleExpression, string>>
{
{SimpleExpressionType.And, LogicalExpressionToWhereClause},
{SimpleExpressionType.Or, LogicalExpressionToWhereClause},
{SimpleExpressionType.Equal, EqualExpressionToWhereClause},
{SimpleExpressionType.NotEqual, NotEqualExpressionToWhereClause},
{SimpleExpressionType.GreaterThan, expr => BinaryExpressionToWhereClause(expr, ">")},
{SimpleExpressionType.GreaterThanOrEqual, expr => BinaryExpressionToWhereClause(expr, ">=")},
{SimpleExpressionType.LessThan, expr => BinaryExpressionToWhereClause(expr, "<")},
{SimpleExpressionType.LessThanOrEqual, expr => BinaryExpressionToWhereClause(expr, "<=")},
};
}
示例15: Execute
internal int Execute(ICommandBuilder commandBuilder, IAdapterTransaction transaction)
{
IDbTransaction dbTransaction = ((AdoAdapterTransaction) transaction).DbTransaction;
return Execute(commandBuilder, dbTransaction);
}