我正在研究原型 CQRS 实现并尝试将 Jonathan Oliver 的事件存储与 MS SQL 服务器一起使用:
_store = Wireup.Init()
.UsingSqlPersistence("EventStore")
.InitializeDatabaseSchema()
.UsingJsonSerialization()
.Build();
我在 app.config 中定义了一个匹配的连接字符串:
<connectionStrings>
<add name="Business.Domain.Repository.Tests.Properties.Settings.EventStore"
connectionString="Data Source=EventStore.sdf;" />
</connectionStrings>
我已经尝试了 SQL CE、本地 SQL、远程 SQL 服务器的连接字符串的变体,并且总是得到这个错误:
System.NullReferenceException was caught
Message=Object reference not set to an instance of an object.
Source=EventStore
StackTrace:
at EventStore.Persistence.SqlPersistence.SqlPersistenceFactory.GetDialect() in c:\Projects\Business\Proto1\EventStore\src\proj\EventStore.Persistence.SqlPersistence\SqlPersistenceFactory.cs:line 53
at EventStore.Persistence.SqlPersistence.SqlPersistenceFactory.Build() in c:\Projects\Business\Proto1\EventStore\src\proj\EventStore.Persistence.SqlPersistence\SqlPersistenceFactory.cs:line 46
at EventStore.SqlPersistenceWireup.<>c__DisplayClass4.<.ctor>b__1(NanoContainer c) in c:\Projects\Business\Proto1\EventStore\src\proj\EventStore.Wireup\SqlPersistenceWireup.cs:line 13
at EventStore.ContainerRegistration.Resolve(NanoContainer container) in c:\Projects\Business\Proto1\EventStore\src\proj\EventStore.Wireup\NanoContainer.cs:line 66
at EventStore.NanoContainer.Resolve[TService]() in c:\Projects\Business\Proto1\EventStore\src\proj\EventStore.Wireup\NanoContainer.cs:line 40
at EventStore.PersistenceWireup.Build() in c:\Projects\Business\Proto1\EventStore\src\proj\EventStore.Wireup\PersistenceWireup.cs:line 47
有没有人遇到过这个或者知道我做错了什么?我尝试单步执行源代码,但仍然不确定为什么会有空引用。-史蒂夫