public DocumentProxyDataMapper(ClientConfiguration configuration, IChangeTrackableContext context) { if (configuration == null) { throw new ArgumentNullException("configuration"); } _serializer = configuration.Serializer.Invoke() as IExtendedTypeSerializer; if (_serializer == null) { throw new NotSupportedException("Change tracking is not supported without an IExtendedTypeSerializer which supports CustomObjectCreator."); } if (!_serializer.SupportedDeserializationOptions.CustomObjectCreator) { throw new NotSupportedException("Change tracking is not supported without an IExtendedTypeSerializer which supports CustomObjectCreator."); } _context = context; _serializer.DeserializationOptions = new DeserializationOptions { CustomObjectCreator = new DocumentProxyTypeCreator() }; }
public DocumentProxyDataMapper(ITypeSerializer serializer, IChangeTrackableContext context) { _serializer = (serializer ?? throw new ArgumentNullException(nameof(serializer))) as IExtendedTypeSerializer; if (_serializer == null || !_serializer.SupportedDeserializationOptions.CustomObjectCreator) { throw new NotSupportedException("Change tracking is not supported without an IExtendedTypeSerializer which supports CustomObjectCreator."); } _context = context; _serializer.DeserializationOptions = new DeserializationOptions { CustomObjectCreator = new DocumentProxyTypeCreator() }; }
public static void ClearStatusOnQueryRequestRows(IEnumerable <TRow> rows, IChangeTrackableContext context) { if (rows != null) { foreach (var row in rows) { var status = row as ITrackedDocumentNode; if (status != null) { // Track the document context.Track(row); // Clear the deserialization flags to start change tracking status.ClearStatus(); } } } }
public static void ClearStatusOnQueryRequestRows <T>(IQueryResult <T> result, IChangeTrackableContext context) { if (result.Rows != null) { foreach (var row in result.Rows) { var status = row as ITrackedDocumentNode; if (status != null) { // Track the document context.Track(row); // Register the context so that it can handled the changed document status.RegisterChangeTracking(context); // Clear the deserialization flags to start change tracking status.ClearStatus(); } } } }