Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Web/CustomModelMetadataProvider/ResolverThroughResource.cs @ 112:0bca45e1e664
Pantalla de Perfil donde se puede asociar la cuenta de twitter al usuario existente
author | Nelo@Kenia.neluz.int |
---|---|
date | Sat, 11 Jun 2011 01:20:59 -0300 |
parents | ee4e699e4551 |
children |
line wrap: on
line source
using System; namespace AltNetHispano.Agendas.Web.CustomModelMetadataProvider { public class ResolverThroughResource<T> : IResolverByConvention { public string GetDisplayName(string propertyName) { return SearchResource(propertyName); } public string GetDescription(string propertyName) { return SearchResource(propertyName + "Description"); } public Type ResourceType { get { return typeof(T); } } private static string SearchResource(string resourceName) { string displayName = null; var resourceType = typeof(T); var prop = resourceType.GetProperty(resourceName); if (prop != null) { var value = prop.GetValue(resourceType, null); displayName = value != null ? value.ToString() : resourceName; } return displayName; } } }