# HG changeset patch
# User nelopauselli
# Date 1306283826 10800
# Node ID 7e9ffde4022d9333da86519cd9683117c28f902d
# Parent c8897b1c6f49aedcfd76a68fb7269ac7b500dc27
Implementando DataAnnotation desde recursos y por convención
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Resources/Agendas.Resources.csproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Resources/Agendas.Resources.csproj Tue May 24 21:37:06 2011 -0300
@@ -0,0 +1,64 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {444D25FB-FC1C-48DC-9EAD-D4C78F2A10CA}
+ Library
+ Properties
+ AltNetHispano.Agendas.Resources
+ AltNetHispano.Agendas.Resources
+ v4.0
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ DataAnnotationResources.resx
+
+
+
+
+ PublicResXFileCodeGenerator
+ DataAnnotationResources.Designer.cs
+
+
+
+
+
\ No newline at end of file
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Resources/Properties/AssemblyInfo.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Resources/Properties/AssemblyInfo.cs Tue May 24 21:37:06 2011 -0300
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Agendas.Resources")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Agendas.Resources")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("f1f30a73-9935-4d8f-9a40-6a1fdcb9ff95")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Resources/Properties/DataAnnotationResources.Designer.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Resources/Properties/DataAnnotationResources.Designer.cs Tue May 24 21:37:06 2011 -0300
@@ -0,0 +1,126 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.225
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace AltNetHispano.Agendas.Resources.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class DataAnnotationResources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal DataAnnotationResources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AltNetHispano.Agendas.Resources.Properties.DataAnnotationResources", typeof(DataAnnotationResources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to debe ingresar la fecha del evento.
+ ///
+ public static string FechaRequired {
+ get {
+ return ResourceManager.GetString("FechaRequired", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to debe ingresar el nombre del ponente.
+ ///
+ public static string PonenteRequired {
+ get {
+ return ResourceManager.GetString("PonenteRequired", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Título.
+ ///
+ public static string Titulo {
+ get {
+ return ResourceManager.GetString("Titulo", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Título del evento, el mismo lo identifica entre todos los eventos.
+ ///
+ public static string TituloDescription {
+ get {
+ return ResourceManager.GetString("TituloDescription", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to debe ingresar el título.
+ ///
+ public static string TituloRequired {
+ get {
+ return ResourceManager.GetString("TituloRequired", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Url de la invitación.
+ ///
+ public static string UrlInvitacion {
+ get {
+ return ResourceManager.GetString("UrlInvitacion", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to la url ingresada no es válida.
+ ///
+ public static string UrlInvitacionUrl {
+ get {
+ return ResourceManager.GetString("UrlInvitacionUrl", resourceCulture);
+ }
+ }
+ }
+}
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Resources/Properties/DataAnnotationResources.resx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Resources/Properties/DataAnnotationResources.resx Tue May 24 21:37:06 2011 -0300
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ debe ingresar la fecha del evento
+
+
+ debe ingresar el nombre del ponente
+
+
+ Título
+
+
+ Título del evento, el mismo lo identifica entre todos los eventos
+
+
+ debe ingresar el título
+
+
+ Url de la invitación
+
+
+ la url ingresada no es válida
+
+
\ No newline at end of file
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj
--- a/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Tue May 24 19:31:10 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Tue May 24 21:37:06 2011 -0300
@@ -69,6 +69,7 @@
Global.asax
+
@@ -156,6 +157,10 @@
{306DDA8A-49A5-42E5-A639-A9D3D521865F}
Agendas.Factories
+
+ {444D25FB-FC1C-48DC-9EAD-D4C78F2A10CA}
+ Agendas.Resources
+
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Web/Global.asax.cs
--- a/Agendas/trunk/src/Agendas.Web/Global.asax.cs Tue May 24 19:31:10 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Web/Global.asax.cs Tue May 24 21:37:06 2011 -0300
@@ -2,6 +2,7 @@
using System.Web.Routing;
using AltNetHispano.Agendas.Domain;
using AltNetHispano.Agendas.Factories;
+using AltNetHispano.Agendas.Resources.Properties;
namespace AltNetHispano.Agendas.Web
{
@@ -30,6 +31,8 @@
protected void Application_Start()
{
+ ModelMetadataProviders.Current = new ModelMetadataWithDefaultsProvider(new ModelMetadataLocalizable());
+
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
diff -r c8897b1c6f49 -r 7e9ffde4022d Agendas/trunk/src/Agendas.Web/ModelMetadataWithDefaultsProvider.asax.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Web/ModelMetadataWithDefaultsProvider.asax.cs Tue May 24 21:37:06 2011 -0300
@@ -0,0 +1,121 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Web.Mvc;
+
+namespace AltNetHispano.Agendas.Web
+{
+ public class ModelMetadataWithDefaultsProvider : ModelMetadataProvider
+ {
+ private readonly DataAnnotationsModelMetadataProvider _base;
+
+ public ModelMetadataWithDefaultsProvider(IModelMetadataResolver modelMetadataResolver)
+ {
+ _base = new DataAnnotationsModelMetadataProviderWithAttributes(modelMetadataResolver);
+ }
+
+ public override IEnumerable GetMetadataForProperties(object container, Type containerType)
+ {
+ return _base.GetMetadataForProperties(container, containerType);
+ }
+
+ public override ModelMetadata GetMetadataForProperty(Func