/// <summary> /// Регистрация секции базы данных. /// </summary> /// <param name="info">Информация о цекции бд.</param> /// <returns>Элемент управления секцией бд. </returns> public DbSectionProxy RegisterDbSection(DbSectionInfo info) { if (info == null) throw new ArgumentNullException("info"); var fullSectionInfo = new DbSection(info, () => Resolve(info.DbSectionId)); //if already registered: return registered proxy. if (!_dbSections.TryAdd(info.DbSectionId, fullSectionInfo)) { DbSection dbSection; if (_dbSections.TryGetValue(info.DbSectionId, out dbSection)) { return dbSection.Proxy; } } return fullSectionInfo.Proxy; }
/// <summary> /// Создать секецию бд. /// </summary> /// <param name="dbSectionInfo">Описание секции бд.</param> /// <param name="resolveAction">Метод для разрешения конфликтов.</param> public DbSection(DbSectionInfo dbSectionInfo, Action resolveAction ) { DbSectionInfo = dbSectionInfo; CurrentDbSectionState = GetDefaultDbSectionState(); Proxy = new DbSectionProxy(resolveAction, GetState, this); }