public DesignModeSite (IComponent component, string name, IContainer container, IServiceProvider serviceProvider)
{
- if (serviceProvider == null)
- throw new ArgumentNullException ("serviceProvider");
- if (component == null)
- throw new ArgumentNullException ("component");
- if (container == null)
- throw new ArgumentNullException ("container");
- if (name == null)
- throw new ArgumentNullException ("name");
-
_component = component;
_container = container;
_componentName = name;
}
set {
if (value != _componentName && value != null && value.Trim().Length > 0) {
-
INameCreationService nameService = this.GetService (typeof (INameCreationService)) as INameCreationService;
+ IComponent component = _container.Components[value]; // get the component with that name
- // Get the component with that name, if any
- //
- IComponent component = _container.Components[value];
-
- // check for duplicated name
- //
- if (component == null && nameService != null && !nameService.IsValidName (value)) { // no duplicate name
- value = _componentName;
+ if (component == null &&
+ (nameService == null || (nameService != null && nameService.IsValidName (value)))) {
string oldName = _componentName;
_componentName = value;
-
((DesignerHost)this.GetService (typeof (IDesignerHost))).OnComponentRename (_component, oldName, _componentName);
}
}
serviceInstance = _nestedContainer;
}
- if (serviceInstance == null && _siteSpecificServices != null)
+ // Avoid returning the site specific IServiceContainer
+ if (serviceInstance == null && service != typeof (IServiceContainer) &&
+ _siteSpecificServices != null)
serviceInstance = _siteSpecificServices.GetService (service);
if (serviceInstance == null)