예제 #1
0
 internal static string SerializeType(TypeModel model, Type type)
 {
     if (model != null)
     {
         TypeFormatEventHandler dynamicTypeFormatting = model.DynamicTypeFormatting;
         if (dynamicTypeFormatting != null)
         {
             TypeFormatEventArgs args = new TypeFormatEventArgs(type);
             dynamicTypeFormatting(model, args);
             if (!Helpers.IsNullOrEmpty(args.FormattedName))
             {
                 return(args.FormattedName);
             }
         }
     }
     return(type.AssemblyQualifiedName);
 }
예제 #2
0
 internal static Type DeserializeType(TypeModel model, string value)
 {
     if (model != null)
     {
         TypeFormatEventHandler dynamicTypeFormatting = model.DynamicTypeFormatting;
         if (dynamicTypeFormatting != null)
         {
             TypeFormatEventArgs args = new TypeFormatEventArgs(value);
             dynamicTypeFormatting(model, args);
             if (args.Type != null)
             {
                 return(args.Type);
             }
         }
     }
     return(Type.GetType(value));
 }