Skip to content

Instantly share code, notes, and snippets.

@Aaronontheweb
Created September 11, 2012 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aaronontheweb/3701266 to your computer and use it in GitHub Desktop.
Save Aaronontheweb/3701266 to your computer and use it in GitHub Desktop.
ShardStrategy.ShardingOn Example - taken from RavenDB.NET docs
//from http://ravendb.net/docs/server/scaling-out/sharding
var shards = new Dictionary<string, IDocumentStore>
{
{"Asia", new DocumentStore {Url = "http://localhost:8080"}},
{"Middle East", new DocumentStore {Url = "http://localhost:8081"}},
{"America", new DocumentStore {Url = "http://localhost:8082"}},
};
var shardStrategy = new ShardStrategy(shards)
.ShardingOn<Company>(company => company.Region)
.ShardingOn<Invoice>(x => x.CompanyId);
var documentStore = new ShardedDocumentStore(shardStrategy).Initialize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment