/// <summary>
        /// Registers the specified entity type with the Repository, associating it with the specified namespace.
        /// </summary>
        /// <param name="namespace"></param>
        /// <param name="type"></param>
        public TypedRepositoryConfiguration RegisterEntity(string @namespace, Type type)
        {
            if (String.IsNullOrEmpty(@namespace))
            {
                throw new ArgumentNullException("namespace", @"A Namespace must be defined when registring an Entity Type.");
            }

            //Validate the namespace parameter.
            Uri entityNamespaceUri;

            if (Uri.TryCreate(@namespace, UriKind.Absolute, out entityNamespaceUri) == false)
            {
                throw new ArgumentException("The Namespace parameter must conform to a valid absolute Uri.");
            }

            if (type == null)
            {
                throw new ArgumentNullException("type", @"The Entity Type must be defined.");
            }

            lock (SyncRoot)
            {
                if (RegisteredEntityDefinitions.Any(ed => ed.EntityNamespace == @namespace))
                {
                    RegisteredEntityDefinitions.Remove(@namespace);
                }

                RegisteredEntityDefinitions.Add(new EntityDefinition
                {
                    EntityNamespace = @namespace,
                    EntityType      = type,
                });
            }
            return(this);
        }
        /// <summary>
        /// Registers and associates the Entity Part Type with the parent Entity Type, associating the entity part with the specified name.
        /// </summary>
        /// <param name="parentEntityType"></param>
        /// <param name="entityPartName"></param>
        /// <param name="entityPartType"></param>
        public TypedRepositoryConfiguration RegisterEntityPart(Type parentEntityType, string entityPartName, Type entityPartType)
        {
            if (parentEntityType == null)
            {
                throw new ArgumentNullException("parentEntityType", @"When registering an entity part, the parent entity type must be specified.");
            }

            if (String.IsNullOrEmpty(entityPartName))
            {
                throw new ArgumentNullException("entityPartName", @"An Entity Part Name must be specified.");
            }

            if (entityPartType == null)
            {
                throw new ArgumentNullException("entityPartType", @"When registering an entity part, the entity part type must be specified.");
            }

            var parentEntityDefinition = RegisteredEntityDefinitions.FirstOrDefault(ed => ed.EntityType == parentEntityType);

            if (parentEntityDefinition == null)
            {
                throw new InvalidOperationException("The Parent Entities' type must first be registered with the Repository prior to being associated with an Entity Part.");
            }

            lock (SyncRoot)
            {
                if (parentEntityDefinition.EntityPartDefinitions.Any(p => p.EntityPartName == entityPartName))
                {
                    parentEntityDefinition.EntityPartDefinitions.Remove(entityPartName);
                }

                //We've run the gauntlet, add the entity part definition.
                parentEntityDefinition.EntityPartDefinitions.Add(new EntityPartDefinition
                {
                    EntityPartName = entityPartName,
                    EntityPartType = entityPartType,
                });
            }
            return(this);
        }