1

我正在研究原型 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

有没有人遇到过这个或者知道我做错了什么?我尝试单步执行源代码,但仍然不确定为什么会有空引用。-史蒂夫

4

1 回答 1

3

我正在更新一些现在围绕方言检测的错误处理。您需要在连接字符串中添加“providerName”,例如:

 <add name="Business.Domain.Repository.Tests.Properties.Settings.EventStore"
  providerName="System.Data.SqlServerCe.3.5"
  connectionString="Data Source=EventStore.sdf;" />

连接配置中的 providerName 属性允许 EventStore 在连接到数据库实例时知道使用哪个驱动程序。

于 2011-04-14T01:34:29.887 回答