AllowedZones applied twice (inheritance)

Topics: Developer Forum
Sep 20, 2008 at 3:08 PM
Hi! Looks like if i inherit from some item class with AllowedZones, i can't apply new zone information to the child class using AllowedZones again.
The problems is within AllowedZonesAttribute.Refine:

currentDefinition.AllowedZoneNames = ZoneNames; // where ZoneNames is a fixed array

This code replaces allowed zones with some others. I guess it should add zones to it's instead.
The other problem is that before this call currentDefinition.AllowedZoneNames is a List, and after that call it will become array. This makes
method ItemDefinition.AddAllowedZone unusable, because it's trying to add item to fixed array.
Sep 20, 2008 at 3:13 PM
Here is a fix:

 

public void Refine(ItemDefinition currentDefinition, IList<ItemDefinition> allDefinitions)

 

{

 

foreach (string s in this.zoneNames)

 

currentDefinition.AddAllowedZone(s);

}