Permalink
Browse files

Fix AOT Issue when writing cutom POCO DTOs

  • Loading branch information...
1 parent df533a6 commit fbbb9da069f1fac6d67d88e6c31cd25d1e30cfb1 @pseabury committed Jul 9, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 src/ServiceStack.Text/JsConfig.cs
View
23 src/ServiceStack.Text/JsConfig.cs
@@ -207,6 +207,29 @@ public static void RegisterForAot()
RegisterCsvSerializer();
}
+ [MonoTouch.Foundation.Preserve]
+ public static bool RegisterTypeForAot<T>()
+ {
+ bool ret = false;
+ try
+ {
+ JsonAotConfig.Register<T>();
+
+ int i = 0;
+ if(JsvWriter<T>.WriteFn() != null && JsvReader<T>.GetParseFn() != null) i++;
+ if(JsonWriter<T>.WriteFn() != null && JsonReader<T>.GetParseFn() != null) i++;
+ if(QueryStringWriter<Poco>.WriteFn() != null) i++;
+
+ CsvSerializer<T>.WriteFn();
+ CsvSerializer<T>.WriteObject(null, null);
+ CsvWriter<T>.WriteObject(null, null);
+ CsvWriter<T>.WriteObjectRow(null, null);
+ ret = true;
+ }catch(Exception){}
+
+ return ret;
+ }
+
[MonoTouch.Foundation.Preserve]
static void RegisterQueryStringWriter()
{

0 comments on commit fbbb9da

Please sign in to comment.