/// <summary> /// Gets the specified attribute field value for the element. /// </summary> /// <param name="table">The attribute table that has the field.</param> /// <param name="field">The field for which to get the value.</param> /// <returns>An object that holds the value. Returns null, if the value was not found.</returns> // [System::Runtime::CompilerServices::IndexerNameAttribute("Attribute")] public object this[OlapAttributeTable table, OlapAttributeTableField field] { get { string key = string.Empty; bool cacheAttribute = false; int tableId = table.Id; if (_dimension.CacheAttributes) { key = string.Concat(_name, KeySeparator, field.Name); cacheAttribute = true; bool found = false; switch (tableId) { case 1: found = _dimension.Attribute1Cache.ContainsKey(key); if (found) { return(_dimension.Attribute1Cache[key]); } break; case 2: found = _dimension.Attribute2Cache.ContainsKey(key); if (found) { return(_dimension.Attribute2Cache[key]); } break; case 3: found = _dimension.Attribute3Cache.ContainsKey(key); if (found) { return(_dimension.Attribute3Cache[key]); } break; default: throw new OlapException("Invalid attribute table requested"); } } OlapAttributeTableFieldDefinition def = new OlapAttributeTableFieldDefinition(); def.Type = (char)field.Type; def.Decimals = field.Decimals; def.FieldWidth = field.Width; object result = NativeOlapApi.AttributeGetValue(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, tableId, field.Name, _name, def, _dimension.Server.LastErrorInternal); if (cacheAttribute) { switch (tableId) { case 1: _dimension.Attribute1Cache.Add(key, result); break; case 2: _dimension.Attribute2Cache.Add(key, result); break; case 3: _dimension.Attribute3Cache.Add(key, result); break; } } return(result); } set { OlapAttributeTableFieldDefinition def = new OlapAttributeTableFieldDefinition(); def.Type = (char)field.Type; def.Decimals = field.Decimals; def.FieldWidth = field.Width; NativeOlapApi.AttributeSetValue(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, table.Id, field.Name, _name, def, value, _dimension.Server.LastErrorInternal); } }