/// <summary> /// Creates a new prevalence engine for the prevalent system /// type specified by the systemType argument with the option /// to automatically support the migration from older serialization /// layout versions. /// </summary> /// <param name="systemType">prevalent system type, must be serializable</param> /// <param name="prevalenceBase">directory where to store log files</param> /// <param name="autoVersionMigration">include support for auto version migration</param> /// <param name="handler">delegate to receive notifications about any exceptions during recovery</param> /// <returns>a new prevalence engine</returns> public static PrevalenceEngine CreateEngine(System.Type systemType, string prevalenceBase, bool autoVersionMigration, PrevalenceEngine.ExceptionDuringRecoveryHandler handler) { CheckEngineParameters(systemType, prevalenceBase); BinaryFormatter formatter; if (autoVersionMigration) { formatter = CreateAutoVersionMigrationFormatter(systemType); } else { formatter = CreateBinaryFormatter(); } return(CreateRequestedEngine(systemType, prevalenceBase, formatter, handler)); }
/// <summary> /// Creates a new prevalence engine for the prevalent system /// type specified by the systemType argument. /// </summary> /// <param name="systemType">prevalent system type, must be serializable</param> /// <param name="prevalenceBase">directory where to store log files</param> /// <param name="formatter">serialization formatter that should be used for reading from/writing to the logs</param> /// <param name="handler">delegate to receive notifications of any exceptions thrown during recovery</param> /// <returns>a new prevalence engine</returns> public static PrevalenceEngine CreateEngine(System.Type systemType, string prevalenceBase, BinaryFormatter formatter, PrevalenceEngine.ExceptionDuringRecoveryHandler handler) { CheckEngineParameters(systemType, prevalenceBase); Assertion.AssertParameterNotNull("formatter", formatter); return(CreateRequestedEngine(systemType, prevalenceBase, formatter, handler)); }
private static PrevalenceEngine CreateRequestedEngine(System.Type systemType, string prevalenceBase, BinaryFormatter formatter, PrevalenceEngine.ExceptionDuringRecoveryHandler handler) { if (Attribute.IsDefined(systemType, typeof(Bamboo.Prevalence.Attributes.TransparentPrevalenceAttribute), false)) { return(new TransparentPrevalenceEngine(systemType, prevalenceBase, formatter, handler)); } else { return(new PrevalenceEngine(systemType, prevalenceBase, formatter, handler)); } }
public TransparentPrevalenceEngine(System.Type systemType, string prevalenceBase, BinaryFormatter formatter, PrevalenceEngine.ExceptionDuringRecoveryHandler handler) : base(systemType, prevalenceBase, formatter, handler) { CreateProxy(); }