public object BuildObject()
        {
            if (_concreteEntityBuilder == null)
            {
                //we'll assume that this is the root class in the hierarchy.
                _concreteEntityBuilder = new ConcreteClassMapBuilder(_classMap);
                foreach (var pair in _properties)
                    _concreteEntityBuilder.AddProperty(pair.Key, pair.Value);
            }

            return _concreteEntityBuilder.BuildObject();
        }
        public object BuildObject()
        {
            if (_concreteEntityBuilder == null)
            {
                //we'll assume that this is the root class in the hierarchy.
                _concreteEntityBuilder = new ConcreteClassMapBuilder(_classMap);
                foreach (var pair in _properties)
                {
                    _concreteEntityBuilder.AddProperty(pair.Key, pair.Value);
                }
            }

            return(_concreteEntityBuilder.BuildObject());
        }
        public void AddProperty(string name, object value)
        {
            if (_concreteEntityBuilder != null)
                _concreteEntityBuilder.AddProperty(name, value);
            else if (_classMap.DiscriminatorAlias == name)
            {
                //we have found our discriminator and *can* instantiate our type
                _classMap = _classMap.GetClassMapFromDiscriminator(value);
                _concreteEntityBuilder = new ConcreteClassMapBuilder(_classMap);
                foreach (var pair in _properties)
                    _concreteEntityBuilder.AddProperty(pair.Key, pair.Value);

                _properties.Clear();
            }
            else
                _properties.Add(name, value);
        }
        public void AddProperty(string name, object value)
        {
            if (_concreteEntityBuilder != null)
            {
                _concreteEntityBuilder.AddProperty(name, value);
            }
            else if (_classMap.DiscriminatorAlias == name)
            {
                //we have found our discriminator and *can* instantiate our type
                _classMap = _classMap.GetClassMapFromDiscriminator(value);
                _concreteEntityBuilder = new ConcreteClassMapBuilder(_classMap);
                foreach (var pair in _properties)
                {
                    _concreteEntityBuilder.AddProperty(pair.Key, pair.Value);
                }

                _properties.Clear();
            }
            else
            {
                _properties.Add(name, value);
            }
        }