Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Web/CustomModelMetadataProvider/ResolverThroughResource.cs @ 120:c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Modificacion de publicador de blog para usar TrackLog
Agregado de TrackLog en el test de crud de eventos
Fix en publicador de twitter para que no twitee si ya se encuentra en TrackLog pero con Successful en true
author | Jorge@Jorge-PC |
---|---|
date | Fri, 24 Jun 2011 21:18:21 -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; } } }