当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteCommand.SetTransaction方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:VincentSchippefilt,项目名称:ncqrs,代码行数:8,代码来源:SQLiteEventStore.cs

示例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();
                }
            }
        }
开发者ID:VincentSchippefilt,项目名称:ncqrs,代码行数:24,代码来源:SQLiteEventStore.cs

示例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();
     }
 }
开发者ID:VincentSchippefilt,项目名称:ncqrs,代码行数:8,代码来源:SQLiteEventStore.cs

示例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();
     }
 }
开发者ID:VincentSchippefilt,项目名称:ncqrs,代码行数:13,代码来源:SQLiteEventStore.cs

示例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();
     }
 }
开发者ID:SzymonPobiega,项目名称:ncqrs,代码行数:11,代码来源:SQLiteEventStore.cs


注:本文中的System.Data.SQLite.SQLiteCommand.SetTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。