Permalink
Browse files

Added the ability to modify Raven conventions during wireup

  • Loading branch information...
1 parent 07ee971 commit 0515d3fb69aaec6f118c2a001f4f2ea16b9422c9 @kblooie kblooie committed Jan 28, 2013
@@ -73,9 +73,21 @@
<Project>{421664DB-C18D-4499-ABC1-C9086D525F80}</Project>
<Name>EventStore.Wireup</Name>
</ProjectReference>
+ <Reference Include="Raven.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\packages\RavenDB.Client.2.0.2230\lib\net40\Raven.Abstractions.dll</HintPath>
+ </Reference>
+ <Reference Include="Raven.Client.Lightweight">
+ <HintPath>..\..\packages\RavenDB.Client.2.0.2230\lib\net40\Raven.Client.Lightweight.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Transactions" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
@@ -1,3 +1,5 @@
+using Raven.Client.Document;
+
namespace EventStore
{
using System;
@@ -20,6 +22,7 @@ public class RavenPersistenceWireup : PersistenceWireup
private string partition = null;
private string connectionName;
private string connectionString;
+ Action<DocumentConvention> customizeConventions;
public RavenPersistenceWireup(Wireup inner)
: this(inner, string.Empty)
@@ -44,7 +47,8 @@ public RavenPersistenceWireup(Wireup inner, string connectionName)
ConnectionString = this.connectionString,
DefaultDatabase = this.defaultDatabase,
Url = this.url,
- Partition = this.partition
+ Partition = this.partition,
+ CustomizeConventions = this.customizeConventions
});
this.Container.Register(c => new RavenPersistenceFactory(c.Resolve<RavenConfiguration>()).Build());
@@ -123,6 +127,13 @@ public virtual RavenPersistenceWireup StaleQueries()
return this.ConsistentQueries(false);
}
+ public virtual RavenPersistenceWireup WithCustomConventions(Action<DocumentConvention> conventionsAction)
+ {
+ this.customizeConventions = conventionsAction;
+
+ return this;
+ }
+
public virtual RavenPersistenceWireup WithSerializer(IDocumentSerializer instance)
{
Logger.Debug("Registering serializer of type '{0}'.", instance.GetType());
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="RavenDB.Client" version="2.0.2230" targetFramework="net40" />
+</packages>
@@ -1,3 +1,5 @@
+using Raven.Client.Document;
+
namespace EventStore.Persistence.RavenPersistence
{
using System;
@@ -16,7 +18,9 @@ public class RavenConfiguration
public TransactionScopeOption ScopeOption { get; set; }
public bool ConsistentQueries { get; set; }
public int RequestedPageSize { get; set; }
- public int MaxServerPageSize { get; set; }
+ public int MaxServerPageSize { get; set; }
+ public Action<DocumentConvention> CustomizeConventions { get; set; }
+
public int PageSize
{
get
@@ -33,6 +33,9 @@ protected virtual IDocumentStore GetStore()
if (!string.IsNullOrEmpty(this.config.DefaultDatabase))
store.DefaultDatabase = this.config.DefaultDatabase;
+ if (config.CustomizeConventions != null)
+ config.CustomizeConventions(store.Conventions);
+
store.Initialize();
return store;

0 comments on commit 0515d3f

Please sign in to comment.