Exemplo n.º 1
0
        /// <summary>
        /// Processes the properties.
        /// </summary>
        /// <param name="properties">The properties.</param>
        /// <exception cref="System.NullReferenceException">Could not find data mapper for property {0} on type {1}
        ///                         .Formatted(property.PropertyInfo.Name,property.PropertyInfo.ReflectedType.FullName)</exception>
        private void ProcessProperties(IEnumerable <AbstractPropertyConfiguration> properties)
        {
            DataMapperResolver runner = new DataMapperResolver(DependencyResolver.ResolveAll <IDataMapperResolverTask>());

            foreach (var property in properties)
            {
                DataMapperResolverArgs args = new DataMapperResolverArgs(this, property);
                args.PropertyConfiguration = property;
                args.DataMappers           = DependencyResolver.ResolveAll <AbstractDataMapper>();
                runner.Run(args);
                if (args.Result == null)
                {
                    throw new NullReferenceException(
                              "Could not find data mapper for property {0} on type {1}"
                              .Formatted(property.PropertyInfo.Name, property.PropertyInfo.ReflectedType.FullName));
                }
                property.Mapper = args.Result;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes the properties.
        /// </summary>
        /// <param name="properties">The properties.</param>
        /// <exception cref="System.NullReferenceException">Could not find data mapper for property {0} on type {1}
        ///                         .Formatted(property.PropertyInfo.Name,property.PropertyInfo.ReflectedType.FullName)</exception>
        private void ProcessProperties(IEnumerable<AbstractPropertyConfiguration> properties )
        {
            DataMapperResolver runner = new DataMapperResolver(DependencyResolver.ResolveAll<IDataMapperResolverTask>());

            foreach(var property in properties)
            {

                DataMapperResolverArgs args = new DataMapperResolverArgs(this, property);
                args.PropertyConfiguration = property;
                args.DataMappers = DependencyResolver.ResolveAll<AbstractDataMapper>();
                runner.Run(args);
                if(args.Result == null)
                {
                    throw new NullReferenceException(
                        "Could not find data mapper for property {0} on type {1}"
                        .Formatted(property.PropertyInfo.Name,property.PropertyInfo.ReflectedType.FullName));
                }
                property.Mapper = args.Result;
            }
        }