Created
February 28, 2012 09:33
-
-
Save tomaszkubacki/1931527 to your computer and use it in GitHub Desktop.
This file contains 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 interface IAliasProvider { | |
string GetModelAlias(Type modelType); | |
string GetPropertyAlias(PropertyInfo propertyInfo); | |
} | |
public class DefaultAliasProvider : IAliasProvider | |
{ | |
public string GetModelAlias(Type modelType) | |
{ | |
var modelAliasAttr = modelType.FirstAttribute<AliasAttribute>(); | |
return modelAliasAttr != null ? modelAliasAttr.Name : null; | |
} | |
public string GetPropertyAlias(PropertyInfo propertyInfo) | |
{ | |
var aliasAttr = propertyInfo.FirstAttribute<AliasAttribute>(); | |
return aliasAttr != null ? aliasAttr.Name : null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment