/// <summary> /// Specify an explicit property mapping /// </summary> /// <param name="xPathQuery">XPath query for the source node to get, starting from root</param> /// <param name="targetPropertyExpression">Accessor for the target property to set</param> /// <returns></returns> public XDocumentMap <TTarget> Specify(string xPathQuery, Expression <Func <TTarget, object> > targetPropertyExpression) { var mapping = new XPathMapping(xPathQuery, targetPropertyExpression); MappingStrategy.AddMapping(mapping); return(this); }
/// <summary> /// Specify an explicit property mapping with a value conversion /// </summary> /// <typeparam name="TInput">Source property type</typeparam> /// <typeparam name="TOutput">Target property type</typeparam> /// <param name="xPathQuery">XPath query for the source node to get, starting from root</param> /// <param name="targetPropertyExpression">Accessor for the target property to set</param> /// <param name="conversion">Conversion function to apply to the source value</param> /// <returns></returns> public XDocumentMap <TTarget> Specify <TInput, TOutput>(string xPathQuery, Expression <Func <TTarget, TOutput> > targetPropertyExpression, Func <TInput, TOutput> conversion) { var mapping = new XPathMapping(xPathQuery, targetPropertyExpression); mapping.SetConversion <TInput, TOutput>(conversion); MappingStrategy.AddMapping(mapping); return(this); }