我正在创建WCF Web服务
以下是我的界面
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "DocumentDispatchPolicyNo", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
List<DispatchDocument> DocumentDispatchPolicyNoPost(string CorrelationID, string PolicyNumber);
我在SVC文件中的功能是
public List<DispatchDocument> DocumentDispatchPolicyNoPost(string CorrelationID, string PolicyNumber)
{
List<DispatchDocument> RInfo = new List<DispatchDocument>();
.....
return RInfo;
}
我的OutPut
{ “添加”:“ASHIRWAD-59第4层,平板4-B TC ROAD,新ALI PUR KOLKATA 700053 Pin-WEST BENGA”, “ChequeAmount”:“0.00”, “ChequeDate”:“”, “支票号码”: ””, “部门”:“POS”, “DispatchDate”:“2016年10月27日”, “DispatchID”:“2_118629”, “DispatchMode”:“I-POST”, “DispatchStatus”:“SENT”, “DispatchType”:“直接向客户”, “信息”: ””, “PODNumber”:“”, “收到的日期”: ””, “状态”:“成功”, “票号”: ”” }
但我希望输出为
{ 的 DocumentDispatch : [ { '添加':'ASHIRWAD-59第4层,平4-B TC路,新ALI PUR KOLKATA 700053 Pin-WEST BENGA', 'ChequeAmount':'0.00', 'ChequeDate':'', '支票号码': '', '部门':'POS', 'DispatchDate':'27 -Oct-2016', 'DispatchID':'2_118629', 'DispatchMode':'I-POST', 'DispatchStatus':'SENT', 'DispatchType':'直接面向客户', '信息': '', 'PODNumber':'', '收到的日期': '', '状态':'成功', '票号': '' }] }
答案 0 :(得分:1)
创建以下类
class ImageManager: NSObject {
static let shared = ImageManager()
private var imageDownloader: ImageDownloader!
private var imageCache: AutoPurgingImageCache!
// Configuration
var maximumActiveDownloads = 5
var placeholderImage: UIImage!
var imageTransitionDuration: NSTimeInterval = 0.5
// The total memory capacity of the cache in MB.
var memoryCapacity: UInt64 = 150
//The preferred memory usage after purge in MB. During a purge, images will be purged until the memory capacity drops below this limit.
var memoryUsageAfterPurge: UInt64 = 60
private override init() {
super.init()
imageCache = AutoPurgingImageCache(
memoryCapacity: memoryCapacity * 1024 * 1024,
preferredMemoryUsageAfterPurge: memoryUsageAfterPurge * 1024 * 1024
)
imageDownloader = ImageDownloader(
configuration: ImageDownloader.defaultURLSessionConfiguration(),
downloadPrioritization: .FIFO,
maximumActiveDownloads: maximumActiveDownloads,
imageCache: imageCache
)
UIImageView.af_sharedImageDownloader = imageDownloader
}
func setImageOrPlaceholder(onImageView imageView: UIImageView, stringURL: String?) {
guard let correctURL = NSURL.getURL(fromString: stringURL) else {
//debug("URL incorrect!: \(stringURL)", isError: true)
imageView.image = placeholderImage
return
}
let imageTransition: UIImageView.ImageTransition = .CrossDissolve(imageTransitionDuration)
imageView.af_setImageWithURL(correctURL,
placeholderImage: placeholderImage,
filter: nil,
imageTransition: imageTransition,
completion: { response in
// debug("\(response.result.value)")
})
} }
像这样使用上面的类
public class DocumentDispatchObject
{
public List<DispatchDocument> DocumentDispatch
}