本文整理汇总了C#中System.Data.SQLite.SQLiteCommand.SetTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteCommand.SetTransaction方法的具体用法?C# SQLiteCommand.SetTransaction怎么用?C# SQLiteCommand.SetTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SQLite.SQLiteCommand
的用法示例。
在下文中一共展示了SQLiteCommand.SetTransaction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEventSourceVersion
private static void UpdateEventSourceVersion(EventSourceInformation eventSource, SQLiteTransaction transaction)
{
using (var cmd = new SQLiteCommand(Query.UpdateEventSourceVersionQuery, transaction.Connection))
{
cmd.SetTransaction(transaction).AddParam("Id", eventSource.Id);
cmd.ExecuteNonQuery();
}
}
示例2: SaveEvent
private void SaveEvent(UncommittedEvent evnt, SQLiteTransaction transaction)
{
if (evnt == null || transaction == null) throw new ArgumentNullException();
using (var dataStream = new MemoryStream())
{
var bag = _converter.Convert(evnt.Payload);
var formatter = new BinaryFormatter();
formatter.Serialize(dataStream, bag);
var data = dataStream.ToArray();
using (var cmd = new SQLiteCommand(Query.InsertNewEventQuery, transaction.Connection))
{
cmd.SetTransaction(transaction)
.AddParam("SourceId", evnt.EventSourceId)
.AddParam("EventId", evnt.EventIdentifier)
.AddParam("Name", evnt.Payload.GetType().FullName)
.AddParam("Sequence", evnt.EventSequence)
.AddParam("Timestamp", evnt.EventTimeStamp.Ticks)
.AddParam("Data", data);
cmd.ExecuteNonQuery();
}
}
}
示例3: GetVersion
private static int? GetVersion(Guid providerId, SQLiteTransaction transaction)
{
using (var command = new SQLiteCommand(Query.SelectVersionQuery, transaction.Connection))
{
command.SetTransaction(transaction).AddParam("Id", providerId);
return (int?)command.ExecuteScalar();
}
}
示例4: AddEventSource
private static void AddEventSource(EventSourceInformation eventSource, SQLiteTransaction transaction)
{
using (var cmd = new SQLiteCommand(Query.InsertNewProviderQuery, transaction.Connection))
{
//TODO
var eventSourceType = typeof (object);
cmd.SetTransaction(transaction)
.AddParam("Id", eventSource.Id)
.AddParam("Type", eventSourceType.ToString())
.AddParam("Version", eventSource.CurrentVersion);
cmd.ExecuteNonQuery();
}
}
示例5: AddEventSource
private void AddEventSource(IEventSource eventSource, SQLiteTransaction transaction)
{
using (var cmd = new SQLiteCommand(Query.InsertNewProviderQuery, transaction.Connection))
{
cmd.SetTransaction(transaction)
.AddParam("Id", eventSource.EventSourceId)
.AddParam("Type", eventSource.GetType().ToString())
.AddParam("Version", eventSource.Version);
cmd.ExecuteNonQuery();
}
}