protected virtual object CreateObject(IObjectSetting objectSetting, IDictionary items, params object[] args)
            {
                var ctx = new ObjectBuilderContext(this, objectSetting, items);
                var instance = this.OnObjectCreating(ctx);
                if (instance != null) {
                    return instance;
                }

                var mapTo = objectSetting.MapTo;
                if (string.IsNullOrEmpty(mapTo)) {
                    mapTo = objectSetting.TypeName;
                }
                mapTo = this.ObjectService.GetTypeNameInternal(mapTo, objectSetting.Namespace);
                instance = TypeHelper.CreateObject(mapTo, null, true, args);
                if(instance != null) {
                    ctx.ObjectInstance = instance;
                    this.OnObjectCreated(ctx);
                }
                return instance;
            }
            protected virtual object CreateObject(IObjectSetting objectSetting, IDictionary items)
            {
                var ctx      = new ObjectBuilderContext(this, objectSetting, items);
                var instance = this.OnObjectCreating(ctx);

                if (instance != null)
                {
                    return(instance);
                }

                this.CheckObjectSettingDependencies(objectSetting);

                var builderType = objectSetting.Builder;

                if (!string.IsNullOrEmpty(builderType))
                {
                    var builder = (Esb.IObjectBuilder) this.ObjectService.GetObjectInternal(builderType, objectSetting.Namespace, typeof(Esb.IObjectBuilder), ctx.Items);
                    if (builder != null)
                    {
                        instance = builder.CreateObject(objectSetting);
                        if (instance != null)
                        {
                            goto EXIT;
                        }
                    }
                }

                var spaceName = objectSetting.Namespace;

                if (objectSetting.Dependencies != null && objectSetting.Dependencies.Length > 0)
                {
                    foreach (var dependencySetting in objectSetting.Dependencies)
                    {
                        var value = dependencySetting.Name;
                        this.ObjectService.GetObjectInternal(value, spaceName, null, items);
                    }
                }

                var mapTo = objectSetting.MapTo;

                if (string.IsNullOrEmpty(mapTo))
                {
                    mapTo = objectSetting.TypeName;
                }
                else
                {
                    instance = this.ObjectService.GetObjectInternal(mapTo, spaceName, null, items);
                    if (instance != null)
                    {
                        return(instance);
                    }
                }
                mapTo = this.ObjectService.GetTypeNameInternal(mapTo, spaceName);

                var constructor = objectSetting.Constructor;

                if (constructor != null)
                {
                    var parameters = constructor.Parameters;
                    if (parameters != null)
                    {
                        var length = parameters.Length;
                        if (length > 0)
                        {
                            var types  = new Type[length];
                            var values = new object[length];
                            for (var i = 0; i < parameters.Length; i++)
                            {
                                var parameter = parameters[i];
                                var typeName  = this.ObjectService.GetTypeNameInternal(parameter.TypeName, spaceName);
                                var type      = TypeHelper.CreateType(typeName, true);
                                types[i] = type;
                                var valueString = parameter.Value;
                                var value       = this.ObjectService.GetObjectInternal(valueString, spaceName, type, items);
                                values[i] = value;
                            }
                            instance = TypeHelper.CreateObject(mapTo, null, true, types, values);
                        }
                    }
                }

                if (instance == null)
                {
                    instance = TypeHelper.CreateObject(mapTo, null, true);
                }

                if (instance != null && objectSetting.Properties != null && objectSetting.Properties.Length > 0)
                {
                    foreach (var property in objectSetting.Properties)
                    {
                        var typeName     = this.ObjectService.GetTypeNameInternal(property.TypeName, spaceName);
                        var type         = TypeHelper.CreateType(typeName, true);
                        var propertyName = property.Name;
                        var valueName    = property.Value;
                        var value        = this.ObjectService.GetObjectInternal(valueName, spaceName, type, items);
                        if (instance is IPropertyDescriptor)
                        {
                            ((IPropertyDescriptor)instance).SetValue(propertyName, value);
                        }
                        else
                        {
                            TypeHelper.SetPropertyValue(instance, propertyName, value);
                        }
                    }
                }

EXIT:

                if (instance != null)
                {
                    ctx.ObjectInstance = instance;
                    this.OnObjectCreated(ctx);
                }

                return(instance);
            }
            protected virtual object CreateObject(IObjectSetting objectSetting, IDictionary items)
            {
                var ctx = new ObjectBuilderContext(this, objectSetting, items);
                var instance = this.OnObjectCreating(ctx);
                if(instance != null) {
                    return instance;
                }

                this.CheckObjectSettingDependencies(objectSetting);

                var builderType = objectSetting.Builder;
                if (!string.IsNullOrEmpty(builderType)) {
                    var builder = (Esb.IObjectBuilder)this.ObjectService.GetObjectInternal(builderType, objectSetting.Namespace, typeof(Esb.IObjectBuilder), ctx.Items);
                    if (builder != null) {
                        instance = builder.CreateObject(objectSetting);
                        if(instance != null) {
                            goto EXIT;
                        }
                    }
                }

                var spaceName = objectSetting.Namespace;
                if (objectSetting.Dependencies != null && objectSetting.Dependencies.Length > 0) {
                    foreach (var dependencySetting in objectSetting.Dependencies) {
                        var value = dependencySetting.Name;
                        this.ObjectService.GetObjectInternal(value, spaceName, null, items);
                    }
                }

                var mapTo = objectSetting.MapTo;
                if (string.IsNullOrEmpty(mapTo)) {
                    mapTo = objectSetting.TypeName;
                } else {
                    instance = this.ObjectService.GetObjectInternal(mapTo, spaceName, null, items);
                    if(instance != null) {
                        return instance;
                    }
                }
                mapTo = this.ObjectService.GetTypeNameInternal(mapTo, spaceName);

                var constructor = objectSetting.Constructor;
                if (constructor != null) {
                    var parameters = constructor.Parameters;
                    if(parameters != null) {
                        var length = parameters.Length;
                        if(length > 0) {
                            var types = new Type[length];
                            var values = new object[length];
                            for(var i = 0; i < parameters.Length; i++) {
                                var parameter = parameters[i];
                                var typeName = this.ObjectService.GetTypeNameInternal(parameter.TypeName, spaceName);
                                var type = TypeHelper.CreateType(typeName, true);
                                types[i] = type;
                                var valueString = parameter.Value;
                                var value = this.ObjectService.GetObjectInternal(valueString, spaceName, type, items);
                                values[i] = value;
                            }
                            instance = TypeHelper.CreateObject(mapTo, null, true, types, values);
                        }
                    }
                }

                if(instance == null) {
                    instance = TypeHelper.CreateObject(mapTo, null, true);
                }

                if(instance != null && objectSetting.Properties != null && objectSetting.Properties.Length > 0) {
                    foreach (var property in objectSetting.Properties) {
                        var typeName = this.ObjectService.GetTypeNameInternal(property.TypeName, spaceName);
                        var type = TypeHelper.CreateType(typeName, true);
                        var propertyName = property.Name;
                        var valueName = property.Value;
                        var value = this.ObjectService.GetObjectInternal(valueName, spaceName, type, items);
                        if (instance is IPropertyDescriptor) {
                            ((IPropertyDescriptor)instance).SetValue(propertyName, value);
                        } else {
                            TypeHelper.SetPropertyValue(instance, propertyName, value);
                        }
                    }
                }

                EXIT:

                if(instance != null) {
                    ctx.ObjectInstance = instance;
                    this.OnObjectCreated(ctx);
                }

                return instance;
            }