protected override ISerializerService GetService(bool compressionEnabled) { if (!services.ContainsKey(compressionEnabled)) { ISerializerService s; if (compressionEnabled) { s = new JSONSerializerService() { SerializationProperties = new SerializationProperties() { CompressionEnabled = true } }; } else { s = new JSONSerializerService(); } services.Add(compressionEnabled, s); } return(services[compressionEnabled]); }
private BaseSerializerService FindBestService() { BaseSerializerService s; if (Manager.BuildProperties.SerializationFormat == SerializationFormat.JSON) { s = new JSONSerializerService(); if (s.IsAvailable()) { return(s); } } if (Manager.BuildProperties.SerializationFormat == SerializationFormat.XML) { s = new XmlSerializerService(); if (s.IsAvailable()) { return(s); } } // service for the configured serialization format is unavailable, pick one of the available services s = new JSONSerializerService(); if (s.IsAvailable()) { return(s); } s = new XmlSerializerService(); if (s.IsAvailable()) { return(s); } throw new Exception("Unsupported serialization format: " + Manager.BuildProperties.SerializationFormat); }
private BaseSerializerService FindBestService() { BaseSerializerService s; if (Manager.BuildProperties.SerializationFormat == SerializationFormat.JSON) { s = new JSONSerializerService(); if (s.IsAvailable()) { return s; } } if (Manager.BuildProperties.SerializationFormat == SerializationFormat.XML) { s = new XmlSerializerService(); if (s.IsAvailable()) { return s; } } // service for the configured serialization format is unavailable, pick one of the available services s = new JSONSerializerService(); if (s.IsAvailable()) { return s; } s = new XmlSerializerService(); if (s.IsAvailable()) { return s; } throw new Exception("Unsupported serialization format: " + Manager.BuildProperties.SerializationFormat); }