据我所知,我应该在我的SQL数据库提交表的有效载荷列中显示JSON,但是我有一个长十六进制字符串。
我的连线代码按照示例进行以下编辑:
private static IStoreEvents WireupEventStore()
{
return Wireup.Init()
.LogToOutputWindow()
.UsingInMemoryPersistence()
.UsingSqlPersistence("EventStore") // Connection string is in app.config
.WithDialect(new MsSqlDialect())
.EnlistInAmbientTransaction() // two-phase commit
.InitializeStorageEngine()
.UsingJsonSerialization()
.HookIntoPipelineUsing(new[] { new AuthorizationPipelineHook() })
.UsingSynchronousDispatchScheduler()
.DispatchTo(new DelegateMessageDispatcher(DispatchCommit))
.Build();
}
任何想法如何获得JSON和使调试更容易?
创建如下视图:
CREATE VIEW [dbo].[DeserializedCommits]
AS
SELECT
[StreamId]
,[StreamRevision]
,[Items]
,[CommitId]
,[CommitSequence]
,[CommitStamp]
,[Dispatched]
,CAST([Headers] AS VARCHAR(MAX)) AS [Headers]
,CAST([Payload] AS VARCHAR(MAX)) AS [Payload]
FROM [dbo].[Commits]
您可以使用Payload
列上的LIKE
来查询您的事件存储。
与此类似的查询将获得Payload列的字符串内容:
Commits
.Select(c => System.Text.Encoding.UTF8.GetString(c.Payload.ToArray()))
.ToList();