Пример #1
0
        ReflectionInfo ReflectFields(Type sourceType)
        {
            ReflectionInfo reflection;

            if ((reflection = harvestCache.TryGet(sourceType)) == null)
            {
                IFieldHarvester harvester;
                if (!configuration.TryGetFieldHarvester(sourceType, out harvester))
                {
                    throw new Exception(string.Format("No fieldharvester is configured for handling type '{0}'. Try using 'ConfigurationHelper.GetStandardConfiguration()' to get started.", sourceType));
                }

                List <SanitiedFieldInfo> fields = harvester.GetFields(sourceType);
                reflection = new ReflectionInfo(fields);
                harvestCache.TryAdd(sourceType, reflection);
            }

            return(reflection);
        }
Пример #2
0
        ReflectionInfo ReflectFields(Type sourceType)
        {
            ReflectionInfo reflection;

            if ((reflection = harvestCache.TryGet(sourceType)) == null)
            {
                IFieldHarvester harvester;
                if (!Configuration.TryGetFieldHarvester(sourceType, out harvester))
                {
                    throw new Exception(string.Format("No fieldharvester is configured for handling type '{0}'", sourceType));
                }

                var fields = harvester.GetFields(sourceType);
                reflection = new ReflectionInfo(fields);
                harvestCache.TryAdd(sourceType, reflection);
            }

            return(reflection);
        }