CSharpTest.Net
TransactedCompoundFile.LoadingRule Enumeration
Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.IO Namespace : TransactedCompoundFile.LoadingRule Enumeration

Glossary Item Box

Defines the loading rule to apply when using a transacted file that was interrupted durring the commit process.

Syntax

Visual Basic (Declaration) 
Public Enum TransactedCompoundFile.LoadingRule 
   Inherits System.Enum
C# 
public enum TransactedCompoundFile.LoadingRule : System.Enum 

Members

MemberDescription
DefaultLoad all from Primary if valid, else load all from Secondary. If both fail, load either Primary or Secondary for each segment. This is the normal option, use the other options only when recovering from a commit that was incomplete.
PrimaryIf you previously called Commit(Action,T) on a prior instance and the Action delegate *was* called, then setting this value will ensure that only the primary state storage is loaded, thereby ensuring you load the 'previous' state.
SecondaryIf you previously called Commit(Action,T) on a prior instance and the Action delegate was *not* called, then setting this value will ensure that only the secondary state storage is loaded, thereby ensuring you load the 'previous' state.

Example

Library/Library.Test/TestTransactedCompoundFile.cs

C#Copy Code
using (TempFile temp = new TempFile())
{
    TransactedCompoundFile.Options o = new TransactedCompoundFile.Options(temp.TempPath);
    Assert.AreEqual(temp.TempPath, o.FilePath);
    Assert.AreEqual(4096, o.BlockSize);
    Assert.AreEqual(8192, o.BlockSize = 8192);
    Assert.AreEqual(false, o.CreateNew);
    Assert.AreEqual(true, o.CreateNew = true);
    Assert.AreEqual(false, o.ReadOnly);
    Assert.AreEqual(true, o.ReadOnly = true);
    Assert.AreEqual(false, o.CommitOnDispose);
    Assert.AreEqual(true, o.CommitOnDispose = true);
    Assert.AreEqual(false, o.CommitOnWrite);
    Assert.AreEqual(true, o.CommitOnWrite = true);
    Assert.AreEqual(FileOptions.None, o.FileOptions);
    Assert.AreEqual(FileOptions.WriteThrough, o.FileOptions = FileOptions.WriteThrough);
    Assert.AreEqual(TransactedCompoundFile.LoadingRule.Default, o.LoadingRule);
    Assert.AreEqual(TransactedCompoundFile.LoadingRule.Primary, o.LoadingRule = TransactedCompoundFile.LoadingRule.Primary);

    TransactedCompoundFile.Options copy = (TransactedCompoundFile.Options) ((ICloneable) o).Clone();
    Assert.AreEqual(FileOptions.WriteThrough, copy.FileOptions);
}
VB.NETCopy Code
Using temp As New TempFile()
    Dim o As New TransactedCompoundFile.Options(temp.TempPath)
    Assert.AreEqual(temp.TempPath, o.FilePath)
    Assert.AreEqual(4096, o.BlockSize)
    Assert.AreEqual(8192, o.BlockSize = 8192)
    Assert.AreEqual(False, o.CreateNew)
    Assert.AreEqual(True, o.CreateNew = True)
    Assert.AreEqual(False, o.[ReadOnly])
    Assert.AreEqual(True, o.[ReadOnly] = True)
    Assert.AreEqual(False, o.CommitOnDispose)
    Assert.AreEqual(True, o.CommitOnDispose = True)
    Assert.AreEqual(False, o.CommitOnWrite)
    Assert.AreEqual(True, o.CommitOnWrite = True)
    Assert.AreEqual(FileOptions.None, o.FileOptions)
    Assert.AreEqual(FileOptions.WriteThrough, o.FileOptions = FileOptions.WriteThrough)
    Assert.AreEqual(TransactedCompoundFile.LoadingRule.[Default], o.LoadingRule)
    Assert.AreEqual(TransactedCompoundFile.LoadingRule.Primary, o.LoadingRule = TransactedCompoundFile.LoadingRule.Primary)

    Dim copy As TransactedCompoundFile.Options = DirectCast((DirectCast(o, ICloneable)).Clone(), TransactedCompoundFile.Options)
    Assert.AreEqual(FileOptions.WriteThrough, copy.FileOptions)
End Using

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         CSharpTest.Net.IO.TransactedCompoundFile.LoadingRule

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys