Created
September 11, 2012 19:31
-
-
Save Aaronontheweb/3701389 to your computer and use it in GitHub Desktop.
Sharding Models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shards = new Dictionary<string, IDocumentStore> | |
{ | |
{"Shard0", new DocumentStore {Url = "http://localhost:8080"}}, | |
{"Shard1", new DocumentStore {Url = "http://localhost:8081"}}, | |
{"Shard2", new DocumentStore {Url = "http://localhost:8082"}}, | |
}; | |
var shardStrategy = new ShardStrategy(shards) | |
.ShardingOn<FoodOrder>(order => order.CustomerId); | |
var documentStore = new ShardedDocumentStore(shardStrategy).Initialize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer{ | |
public string Id {get;set;} | |
public string Email {get;set;} | |
} | |
public class FoodOrder{ | |
public string Id {get;set;} | |
public DateTime DateOrdered {get;set;} | |
public string CustomerId {get;set;} | |
//IDs for food items ordered | |
public List<string> OrderItems | |
{get;set;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment