Skip to content

Commit

Permalink
Convert SQL Storage to using clob for event data instead of blob
Browse files Browse the repository at this point in the history
  • Loading branch information
bradtwurst authored and pjvds committed Nov 1, 2010
1 parent f250915 commit 4e6922e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private StoredEvent<string> ReadEvent(SqlDataReader reader)
var eventVersion = Version.Parse((string)reader["Version"]);
var eventSourceId = (Guid)reader["EventSourceId"];
var eventSequence = (long)reader["Sequence"];
var data = Encoding.UTF8.GetString((Byte[])reader["Data"]);
var data = (String)reader["Data"];

return new StoredEvent<string>(
eventIdentifier,
Expand Down Expand Up @@ -321,7 +321,6 @@ private void SaveEvent(ISourcedEvent evnt, SqlTransaction transaction)

var document = _formatter.Serialize(evnt);
var raw = _translator.TranslateToRaw(document);
var data = Encoding.UTF8.GetBytes(raw.Data);

using (var command = new SqlCommand(Queries.InsertNewEventQuery, transaction.Connection))
{
Expand All @@ -332,7 +331,7 @@ private void SaveEvent(ISourcedEvent evnt, SqlTransaction transaction)
command.Parameters.AddWithValue("Name", raw.EventName);
command.Parameters.AddWithValue("Version", raw.EventVersion.ToString());
command.Parameters.AddWithValue("Sequence", raw.EventSequence);
command.Parameters.AddWithValue("Data", data);
command.Parameters.AddWithValue("Data", raw.Data);
command.ExecuteNonQuery();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[EventSourceId] [uniqueidentifier] NOT NULL,
[Sequence] [bigint],

[Data] [varbinary](max) NOT NULL
[Data] [nvarchar](max) NOT NULL
) ON [PRIMARY]
GO

Expand Down

0 comments on commit 4e6922e

Please sign in to comment.