public virtual void InitOnUp(Transaction systemTrans, FieldMetadata fieldMetadata ) { ObjectContainerBase anyStream = systemTrans.Container(); if (!anyStream.MaintainsIndices()) { return; } if (!fieldMetadata.SupportsIndex()) { Indexed(false); } TernaryBool indexedFlag = _config.GetAsTernaryBool(IndexedKey); if (indexedFlag.DefiniteNo()) { fieldMetadata.DropIndex((LocalTransaction)systemTrans); return; } if (UseExistingIndex(systemTrans, fieldMetadata)) { return; } if (!indexedFlag.DefiniteYes()) { return; } fieldMetadata.CreateIndex(); }
public virtual int AdjustActivationDepth(int depth) { TernaryBool cascadeOnActivate = CascadeOnActivate(); if (cascadeOnActivate.DefiniteYes() && depth < 2) { depth = 2; } if (cascadeOnActivate.DefiniteNo() && depth > 1) { depth = 1; } if (Config().ClassActivationDepthConfigurable()) { int minimumActivationDepth = MinimumActivationDepth(); if (minimumActivationDepth != 0 && depth < minimumActivationDepth) { depth = minimumActivationDepth; } int maximumActivationDepth = MaximumActivationDepth(); if (maximumActivationDepth != 0 && depth > maximumActivationDepth) { depth = maximumActivationDepth; } } return(depth); }
public virtual bool CallConstructor(IReflectClass clazz) { TernaryBool specialized = CallConstructorSpecialized(clazz); if (!specialized.IsUnspecified()) { return(specialized.DefiniteYes()); } return(_config.CallConstructors().DefiniteYes()); }
/// <exception cref="System.IO.IOException"></exception> private void Defrag(TernaryBool generateCommitTimestamp) { DefragmentConfig config = new DefragmentConfig(SourceFile(), BackupFile()); config.Db4oConfig(NewConfiguration()); config.ForceBackupDelete(true); if (!generateCommitTimestamp.IsUnspecified()) { config.Db4oConfig().GenerateCommitTimestamps(generateCommitTimestamp.DefiniteYes( )); } Db4objects.Db4o.Defragment.Defragment.Defrag(config); }
/// <summary> /// Checks if the current configuration scope is globally /// enabled or disabled. /// </summary> /// <remarks> /// Checks if the current configuration scope is globally /// enabled or disabled. /// </remarks> /// <param name="defaultValue">- default result</param> /// <returns> /// false if disabled, true if globally enabled, default /// value otherwise /// </returns> public bool ApplyConfig(TernaryBool defaultValue) { switch (_value) { case DisabledId: { return(false); } case GloballyId: { return(!defaultValue.DefiniteNo()); } default: { return(defaultValue.DefiniteYes()); break; } } }