/// <summary>
 /// Initialize.
 /// </summary>
 /// <param name="context">Entity descriptor context.</param>
 /// <param name="property">Property metadata.</param>
 public EntityValueConverterContext(EntityDescriptorContext context, PropertyMetadata property)
 {
     _Context = context;
     Property = property;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Render a property editor.
 /// </summary>
 /// <param name="helper">A htmlhelper.</param>
 /// <param name="property">Property metadata.</param>
 /// <param name="value">Property value.</param>
 public static void Editor(this HtmlHelper helper, PropertyMetadata property, object value)
 {
     if (helper == null)
         throw new ArgumentNullException("helper");
     if (property == null)
         throw new ArgumentNullException("property");
     MvcEditorModel model = new MvcEditorModel();
     model.Metadata = property;
     model.Value = value;
     if (property.Type == CustomDataType.Other)
         System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(helper, property.CustomType + "Editor", model);
     else
         System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(helper, property.Type.ToString() + "Editor", model);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get converter for a type.
 /// </summary>
 /// <param name="metadata">Property metadata.</param>
 /// <returns></returns>
 public static TypeConverter GetConverter(PropertyMetadata metadata)
 {
     if (metadata == null)
         throw new ArgumentNullException("metadata");
     TypeConverter converter;
     if (metadata.Type == CustomDataType.Other)
         converter = GetConverter(metadata.CustomType);
     else
         converter = GetConverter(metadata.Type);
     if (converter == null)
         converter = TypeDescriptor.GetConverter(metadata.Property.PropertyType);
     return converter;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Get converter for a type.
 /// </summary>
 /// <param name="metadata">Property metadata.</param>
 /// <returns></returns>
 public static TypeConverter GetConverter(PropertyMetadata metadata)
 {
     if (metadata == null)
         throw new ArgumentNullException("metadata");
     if (metadata.Type == CustomDataType.Other)
         return GetConverter(metadata.CustomType);
     else
         return GetConverter(metadata.Type);
 }