public ResolutionResult Resolve(ResolutionResult source)
 {
     if (_nullSubstitute == null)
     {
         return source;
     }
     return source.Value == null
             ? source.New(_nullSubstitute)
             : source;
 }
            public ResolutionResult Resolve(ResolutionResult source)
            {
                // Get the parent FeatureModel
                FeatureModel parentFeatureModel = (FeatureModel)source.Context.InstanceCache.Values.Where(v => v.GetType() == typeof(FeatureModel)).First();

                // Get the Feature corresponding to the given Identifier
                string featureIdentifier = (string)source.Value;
                Feature feature = parentFeatureModel.Features.Where(f => f.Identifier == featureIdentifier).First();
                return source.New(feature);
            }
 public ResolutionResult Resolve(ResolutionResult source)
 {
     try
     {
         return _inner.Resolve(source);
     }
     catch (NullReferenceException)
     {
         return source.New(null, MemberType);
     }
 }
		public ResolutionResult Resolve(ResolutionResult source)
		{
			if (source.Value == null)
				return source;

		    var valueType = source.Value.GetType();
		    if (!(_sourceType.IsAssignableFrom(valueType)))
                throw new ArgumentException("Expected obj to be of type " + _sourceType + " but was " + valueType);

		    var result = _propertyInfo.GetValue(source.Value, null);

			return source.New(result);
		}
 public ResolutionResult Resolve(ResolutionResult source)
 {
     var post = source.Context.DestinationValue as Post;
     var vm = source.Context.SourceValue as PostViewModel;
     var selectedTags = vm.Tags.Split(',');
     var tagsToDelete = post.Tags.Where(t => !selectedTags.Contains(t.Name));
     var tagsToAdd = selectedTags.Where(tagName => !post.Tags.Select(tag => tag.Name).Contains(tagName))
                                 .Select(tagName => availableTags.ContainsKey(tagName)
                                                  ? availableTags[tagName]
                                                  : new Tag { Name = tagName });
     tagsToDelete.ToList().ForEach(tag => post.Tags.Remove(tag));
     tagsToAdd.ToList().ForEach(tag => post.Tags.Add(tag));
     return source.New(post.Tags);
 }
            public ResolutionResult Resolve(ResolutionResult source)
            {
                // Get the parent FeatureModel
                FeatureModel parentFeatureModel = (FeatureModel)source.Context.InstanceCache.Values.Where(v => v.GetType() == typeof(FeatureModel)).First();

                // Get the Features corresponding to the given Identifiers
                List<string> featureIdentifiers = (List<string>)source.Value;
                List<Feature> featuresList = new List<Feature>();
                for (int i = 0; i < featureIdentifiers.Count; i++)
                {
                    Feature feature = parentFeatureModel.Features.Where(f => f.Identifier == featureIdentifiers[i]).First();
                    featuresList.Add(feature);
                }
                return source.New(featuresList);
            }
Example #7
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     var possibleRaids = Mapper.Map<IEnumerable<SelectListItem>>(_context.Set<Raid>().ToList());
     return source.New(possibleRaids, typeof(IEnumerable<SelectListItem>));
 }