public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
 {
     var nested =  context.Nested(SourceProperty, destinationProperty);
     var executable = executor.CreateExecutableMapping(nested.SourceType);
     executable.Execute(nested);
     return new Result(true, nested.Destination);
 }
Beispiel #2
0
        public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
        {
            var nested     = context.Nested(SourceProperty, destinationProperty);
            var executable = executor.CreateExecutableMapping(nested.SourceType);

            executable.Execute(nested);
            return(new Result(true, nested.Destination));
        }
 public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
 {
     //we need to keep the SOURCE the same, but change the destination
     var nested = context.Nested(destinationProperty);
     var executable = executor.CreateExecutableMapping(nested.SourceType);
     executable.Execute(nested);
     return new Result(true, nested.Destination);
 }
        public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
        {
            //we need to keep the SOURCE the same, but change the destination
            var nested     = context.Nested(destinationProperty);
            var executable = executor.CreateExecutableMapping(nested.SourceType);

            executable.Execute(nested);
            return(new Result(true, nested.Destination));
        }
 public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
 {
     if (executor == null)
     {
         throw new DittoConfigurationException("UnflatteningResolver never bound an executable mapping on component type '{0}' for destination '{1}'. " +
             Environment.NewLine+
             "Be sure the type '{0}' is configured as a destination with source '{2}'",destinationType,context.Destination,context.SourceType);
     }
     //we need to keep the SOURCE the same, but change the destination
     var nested = context.Nested(destinationProperty);
     var executable = executor.CreateExecutableMapping(nested.SourceType);
     executable.Execute(nested);
     return new Result(true, nested.Destination);
 }
Beispiel #6
0
        public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
        {
            if (executor == null)
            {
                throw new DittoConfigurationException("UnflatteningResolver never bound an executable mapping on component type '{0}' for destination '{1}'. " +
                                                      Environment.NewLine +
                                                      "Be sure the type '{0}' is configured as a destination with source '{2}'", destinationType, context.Destination, context.SourceType);
            }
            //we need to keep the SOURCE the same, but change the destination
            var nested     = context.Nested(destinationProperty);
            var executable = executor.CreateExecutableMapping(nested.SourceType);

            executable.Execute(nested);
            return(new Result(true, nested.Destination));
        }
Beispiel #7
0
        public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
        {
            var collectionContext = context.Nested(sourceProperty, destinationProperty);
            var src = (IList) context.GetSourcePropertyValue(sourceProperty.Name);
            var dest = (IList)activate.CreateCollectionInstance(destinationProperty.PropertyType, src.Count);
            for (int i = 0; i < src.Count; i++)
            {
                var sourceElement = sourceProperty.ElementAt(i);
                var elementContext = collectionContext.Nested(sourceElement, destinationProperty.ElementAt(i));
                var nestedExecutor = this.executor.CreateExecutableMapping(sourceElement.PropertyType);
                nestedExecutor.Execute(elementContext);
                dest.AddElement(elementContext.Destination,i);
            }

            return new Result(true, dest);
        }
Beispiel #8
0
        public Result TryResolve(IResolutionContext context, IDescribeMappableProperty destinationProperty)
        {
            var collectionContext = context.Nested(sourceProperty, destinationProperty);
            var src  = (IList)context.GetSourcePropertyValue(sourceProperty.Name);
            var dest = (IList)activate.CreateCollectionInstance(destinationProperty.PropertyType, src.Count);

            for (int i = 0; i < src.Count; i++)
            {
                var sourceElement  = sourceProperty.ElementAt(i);
                var elementContext = collectionContext.Nested(sourceElement, destinationProperty.ElementAt(i));
                var nestedExecutor = this.executor.CreateExecutableMapping(sourceElement.PropertyType);
                nestedExecutor.Execute(elementContext);
                dest.AddElement(elementContext.Destination, i);
            }

            return(new Result(true, dest));
        }