Ejemplo n.º 1
0
        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 ExtendedTypeSerializerMemberNameResolver(IExtendedTypeSerializer serializer)
        {
            if (serializer == null)
            {
                throw new ArgumentNullException("serializer");
            }

            _serializer = serializer;
        }
        public ExtendedTypeSerializerMemberNameResolver(IExtendedTypeSerializer serializer)
        {
            if (serializer == null)
            {
                throw new ArgumentNullException("serializer");
            }

            _serializer = serializer;
        }
        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()
            };
        }
Ejemplo n.º 5
0
        public static string GetPath <TDocument, TContent>(IExtendedTypeSerializer serializer, Expression <Func <TDocument, TContent> > path)
        {
            if (serializer == null)
            {
                throw new ArgumentNullException("serializer");
            }
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            var visitor = new SubDocumentPathExpressionVisitor(serializer);

            visitor.Visit(path);

            return(visitor.Path);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new SubDocumentPathExpressionVisitor.
 /// </summary>
 /// <param name="serializer"><see cref="IExtendedTypeSerializer"/> used for member name resolution.</param>
 private SubDocumentPathExpressionVisitor(IExtendedTypeSerializer serializer)
 {
     _serializer = serializer;
 }
Ejemplo n.º 7
0
 public ExtendedTypeSerializerMemberNameResolver(IExtendedTypeSerializer serializer)
 {
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
 }