Created
February 11, 2017 12:24
-
-
Save rmaziarka/d7778d0ae7d3f2e58a1879f4678c4e2e to your computer and use it in GitHub Desktop.
Resolver with improper order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Resolver : IValueResolver<object, object, int>, IValueResolver<object, object, int?> | |
{ | |
public int? Resolve(object source, object destination, int? destMember, ResolutionContext context) | |
{ | |
var result = SomeLogic(source); | |
return result; | |
} | |
public int Resolve(object source, object destination, int destMember, ResolutionContext context) | |
{ | |
var result = this.Resolve(source, destination, (int?)destMember, context); | |
if (result.HasValue) | |
return result.Value; | |
throw new NullReferenceException("Resolver"); | |
} | |
private int? SomeLogic(object source) | |
{ | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment