Exemple #1
0
 public static T FromJson <T>(this AbstractSerializationService service, string json, string intent = null)
 {
     if (json.IsNullOrWhiteSpace())
     {
         return(default(T));
     }
     return((T)service.FromJson(json, typeof(T), intent));
 }
Exemple #2
0
        public static object FromJson(this AbstractSerializationService service, string json, Type outputType, string intent = null)
        {
            if (json.IsNullOrWhiteSpace())
            {
                return(outputType.GetDefaultValue());
            }
            var stream = new MemoryStream(Encoding.UTF8.GetBytes(json));

            return(service.FromStream(stream, outputType, intent));
        }
 protected DefaultFrameworkContext(AbstractScopedCache scopedCache,
     AbstractApplicationCache applicationCache,
     AbstractFinalizer finalizer,
     IFrameworkCaches caches,
     AbstractSerializationService serialization)
 {
     ScopedCache = scopedCache;
     ApplicationCache = applicationCache;
     ScopedFinalizer = finalizer;
     Caches = caches;
     Serialization = serialization;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultFrameworkContext"/> class.
 /// </summary>
 /// <param name="textManager">The text manager.</param>
 /// <param name="typeMappers">The type mappers.</param>
 /// <param name="scopedCache">The scoped cache.</param>
 /// <param name="applicationCache">The application cache</param>
 /// <param name="finalizer">The finalizer.</param>
 /// <param name="taskMgr">The task manager.</param>
 /// <param name="caches">The lifetime-managed cache providers.</param>
 public DefaultFrameworkContext(
     TextManager textManager, 
     MappingEngineCollection typeMappers, 
     AbstractScopedCache scopedCache,
     AbstractApplicationCache applicationCache,
     AbstractFinalizer finalizer,
     ApplicationTaskManager taskMgr,
     IFrameworkCaches caches,
     AbstractSerializationService serialization)
     : this(scopedCache, applicationCache, finalizer, caches, serialization)
 {
     TextManager = textManager;
     TypeMappers = typeMappers;
     TaskManager = taskMgr;
 }
Exemple #5
0
 public static string ToJson(this AbstractSerializationService service, object input, string intent = null)
 {
     return(service.ToStream(input, intent).ResultStream.ToJsonString());
 }