コード例 #1
0
            public ResolutionResult Resolve(ResolutionResult source)
            {
                var propertyMap = source.Context.PropertyMap;

                propertyMap.ShouldNotBeNull();

                var codeValueTypeId = propertyMap.SourceMember.DeclaringType.Name + ":" + propertyMap.SourceMember.Name;
                return source.New(LookupCodeValue(codeValueTypeId, "" + source.Value));
            }
コード例 #2
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     if (_nullSubstitute == null)
     {
         return source;
     }
     return source.Value == null
         ? source.New(_nullSubstitute)
         : source;
 }
コード例 #3
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     try
     {
         return _inner.Resolve(source);
     }
     catch (NullReferenceException)
     {
         return source.New(null, MemberType);
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(DomainEntityState.Unchanged));
 }
コード例 #6
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return source.New(source.Value);
 }
コード例 #7
0
            public ResolutionResult Resolve(ResolutionResult source)
            {
                var pp = source.Value as IEnumerable <PricePosition>;

                return(pp != null?source.New(!pp.Any()? 0 : pp.Min(x => x.Price)) : source.New(0));
            }
コード例 #8
0
ファイル: ContextItems.cs プロジェクト: garora/AutoMapper
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return source.New((int) source.Value + (int)source.Context.Options.Items["Item"]);
 }
コード例 #9
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(Guid.NewGuid()));
 }
コード例 #10
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(((int)source.Value) + 5));
 }
コード例 #11
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New((int)source.Value + (int)source.Context.Options.Items["Item"]));
 }
コード例 #12
0
ファイル: ForAllMaps.cs プロジェクト: mwpowellhtx/MicroMapper
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return source.New(-1);
 }
コード例 #13
0
    public ResolutionResult Resolve(ResolutionResult source)
    {
        var result = GetValueFromKey(property, source.Value);        // gets from some static cache or dictionary elsewhere in your code by reading the prop info and then using that to look up the value based on the key as appropriate

        return source.New(result)
    }
コード例 #14
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(ResolveCore(source, (IMember)source.Value), typeof(string)));
 }
コード例 #15
0
        public ResolutionResult Resolve(ResolutionResult context)
        {
            var value = (long)context.Value;

            return(context.New(FileSizeFormatter.FormatValue(value)));
        }
コード例 #16
0
            /// <summary>
            /// Implementors use source resolution result to provide a destination resolution result.
            ///             Use the <see cref="T:AutoMapper.ValueResolver`2"/> class for a type-safe version.
            /// </summary>
            /// <param name="source">Source resolution result</param>
            /// <returns>
            /// Result, typically build from the source resolution result
            /// </returns>
            public ResolutionResult Resolve(ResolutionResult source)
            {
                TEntity entry = this.ResolveCore(source.Value);

                return(source.New(entry, typeof(TEntity)));
            }
コード例 #17
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New((source.Context.SourceValue as DataRow)[source.Context.MemberName]));
 }
コード例 #18
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(-1));
 }
コード例 #19
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(((ModelSubObject)source.Value).SomeValue + 1));
 }
コード例 #20
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.Value == null
                         ? source.New(source.Value, MemberType)
                         : source.New(GetValue(source.Value), MemberType));
 }
コード例 #21
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(((ModelObject)source.Value).Value4 + 4));
 }
コード例 #22
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(ResolveObject(source)));
 }
コード例 #23
0
ファイル: MemberGetter.cs プロジェクト: CyranoChen/Arsenalcn
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return source.Value == null
         ? source.New(source.Value, MemberType)
         : source.New(GetValue(source.Value), MemberType);
 }
コード例 #24
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(((Order)source.Value).Status));
 }
コード例 #25
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(((TOutputEnum)Enum.Parse(typeof(TOutputEnum), Enum.GetName(typeof(TInputEnum), source.Value), false))));
 }
コード例 #26
0
 public ResolutionResult Resolve(ResolutionResult source)
 {
     return(source.New(Convert.ChangeType((source.Context.SourceValue as DataRow)[source.Context.MemberName], source.Context.DestinationType)));
 }