This interface is implemented by classes that want do their save and load in a special mode.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Interface ICustomPersister |
| C# | |
|---|
public interface ICustomPersister |
| Managed Extensions for C++ | |
|---|
public __gc __interface ICustomPersister |
| C++/CLI | |
|---|
public interface class ICustomPersister |
Example
The following example shows a sample implementation of the interface.
| C# | Copy Code |
|---|
public class MyList<T> : ICustomPersister<T:gt; { private IList<T> _removedList = new List<T>(); public void Load(ObjectContext context, IQuery query) { // Load all objects matching the query. using(ObjectReader<T> reader = context.GetObjectReader<T>(query)) { // Add all objects found to the list. foreach(T obj in reader) this.Add(obj); } } public void Persist(ObjectContext context, PersistDepths persistDepth, PersistingTrace trace) { foreach (T obj in this) context.PersistChanges<T>(obj, persistDepth); // Delete all objects in the RemovedList. foreach (T obj in _removedList) { context.MarkForDeletion(obj); context.PersistChanges<T>(obj, persistDepth); } _removedList.Clear(); } public void MoveToRemovedList(T obj) { this.Remove(obj); _removedList.Add(obj); } // ... Other properties and code. } |
Remarks
Requirements
Namespace: Chili.Opf3
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Chili.Opf3 (in Chili.Opf3.dll)
See Also