NEventStore problem configuring SQL dialect
I am working on a prototype CQRS implementation and trying to use Jonathan Oliver's event store with MS SQL server:
_store = Wireup.Init()
.UsingSqlPersistence("EventStore")
.InitializeDatabaseSchema()
开发者_运维知识库 .UsingJsonSerialization()
.Build();
I have a matching connection string defined in app.config:
<connectionStrings>
<add name="Business.Domain.Repository.Tests.Properties.Settings.EventStore"
connectionString="Data Source=EventStore.sdf;" />
</connectionStrings>
I have tried variations of connection strings for SQL CE, local SQL, remote SQL server's and always get this error:
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
Has anyone come across this before or have an idea what I am doing wrong? I tried stepping through the source and still not sure why there is a null reference. -Steve
I'm updating some of the error handling now surrounding dialect detection. You'll need to add a "providerName" to your connection string, e.g.:
<add name="Business.Domain.Repository.Tests.Properties.Settings.EventStore"
providerName="System.Data.SqlServerCe.3.5"
connectionString="Data Source=EventStore.sdf;" />
Having the providerName attribute in the connection configuration allows the EventStore to know which driver to use when connecting to your database instance.
精彩评论