Пример #1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     DisplayTextAttribute.SetResourceType(typeof(Resources));
 }
Пример #2
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     DisplayTextAttribute.SetResourceType(typeof(Resources));
     ModelMetadataProviders.Current = new ExtendedDataAnnotationsProvider();
 }
Пример #3
0
        protected override CachedDataAnnotationsModelMetadata CreateMetadataPrototype(IEnumerable <Attribute> attributes, Type containerType, Type modelType, string propertyName)
        {
            CachedDataAnnotationsModelMetadata modelMetadata = base.CreateMetadataPrototype(attributes, containerType, modelType, propertyName);

            if (string.IsNullOrEmpty(modelMetadata.DisplayName))
            {
                DisplayTextAttribute displayTextAttribute = attributes.OfType <DisplayTextAttribute>().FirstOrDefault();
                if (null != displayTextAttribute)
                {
                    displayTextAttribute.SetDisplayName(modelMetadata);
                }
            }
            return(modelMetadata);
        }