Using Domain Driven Design Value Objects as Document Keys in RavenDB

October 18, 2012

See here for post on performance considerations of Value Object document keys in RavenDB.

Consider federated authentication where an identity provider, such as Windows Live ID, provides a “name identifier” claim for the user. The name identifier claim would be used in conjunction with another claim specifying the provider (thereby guaranteeing the name identifiers uniqueness) in order to identify the authenticated user. These name and name provider fields only have meaning when used together; both fields require validation; the fields should be immutable; the fields may be used internally within the application. For these reasons they would ideally be encapsulated into a NameIdentifier value object (VO) rather than being two unique and unrelated strings. Further, this value object would act a great identifier for a User entity type.
Continue Reading »