【发布时间】:2011-12-12 22:17:23
【问题描述】:
对于我正在进行的项目,我无法使用 [dbo] 架构。从 EventStore 源代码来看,使用非 dbo 模式看起来并不简单。
到目前为止,我想到的最好的方法是使用这样的自定义方言:
- CommonSqlDialect 子类
- 添加 MsSqlDialect 的私有实例
- 然后覆盖 CommonSqlDialect 的所有虚拟属性以执行类似的操作
例子:
public override string AppendSnapshotToCommit
{
get { return customizeSchema(_msSqlDialect.AppendSnapshotToCommit); }
}
private string customizeSchema(string dboStatement)
{
// replace "[dbo]" with "[notdbo]",
// replace " Commits" with " [notdbo].Commits",
// replace " Snapshots" with " [notdbo].Snapshots"
}
我还必须自定义 InitializeStorage 属性以将“sysobjects”替换为“sys.objects”,这样我就可以在架构名称上添加额外的约束。
这可行,但似乎应该有用于自定义架构和表名称的连线选项。
UsingSqlPersistence(...)
.WithSchema(...)
.WithCommitsTable(...)
.WithSnapshotsTable(...)
有没有明显更好的方法来处理我错过的这个问题?
【问题讨论】:
标签: event-sourcing event-stream neventstore