日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
快速上手篇之WCF自定義集合

學(xué)習(xí)WCF時(shí),你可能會(huì)遇到WCF自定義集合問(wèn)題,這里將介紹WCF自定義集合問(wèn)題的解決方法,在這里拿出來(lái)和大家分享一下。對(duì)于一個(gè)好的分布式系統(tǒng)來(lái)講,設(shè)計(jì)時(shí)應(yīng)當(dāng)考慮到異構(gòu)性、開(kāi)放性、安全性、可擴(kuò)展性、故障處理、并發(fā)性以及透明性等問(wèn)題。基于SOAP的Web Service可以實(shí)現(xiàn)異構(gòu)環(huán)境的互操作性,保證了跨平臺(tái)的通信。

專注于為中小企業(yè)提供成都做網(wǎng)站、網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)隴川免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了超過(guò)千家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

#T#利用WSE(Web Service Enhancements)可以為ASMX提供安全性的保證。.NET Remoting具有豐富的擴(kuò)展功能,可以創(chuàng)建定制的信道、格式化器和代理程序。Enterprise Service(COM+)提供了對(duì)事務(wù)的支持,其中還包括分布式事務(wù),可實(shí)現(xiàn)故障的恢復(fù)。MSMQ可以支持異步調(diào)用、脫機(jī)連接、斷點(diǎn)連接等功能,利用消息隊(duì)列支持應(yīng)用程序之間的消息傳遞。從功能角度來(lái)看,WCF整合了ASMX、.Net Remoting、Enterprise Service、WSE以及MSMQ等現(xiàn)有技術(shù)的優(yōu)點(diǎn),它提供了一種構(gòu)建安全可靠的分布式面向服務(wù)系統(tǒng)的統(tǒng)一的框架模型,使軟件研發(fā)人員在開(kāi)發(fā)分布式應(yīng)用時(shí)變得更加輕松。

集合元素類的定義如下:

 
 
  1. public enum FileType  
  2. {  
  3. TXT,DOC,HTML,OTHER  
  4. }  
  5. [DataContract]  
  6. public class Document  
  7. {  
  8. private string m_localPath;  
  9. private string m_fileName;  
  10. private FileType m_fileType;         
  11.  
  12. [DataMember]  
  13. public string LocalPath  
  14. {  
  15. get { return m_localPath; }  
  16. set { m_localPath = value; }  
  17. }  
  18.  
  19. [DataMember]  
  20. public string FileName  
  21. {  
  22. get { return m_fileName; }  
  23. set { m_fileName = value; }  
  24. }  
  25. [DataMember]  
  26. public FileType FileType  
  27. {  
  28. get { return m_fileType; }  
  29. set { m_fileType = value; }  
  30. }  
  31.  
  32. }  

WCF自定義集合DocumentList則實(shí)現(xiàn)了IList接口:

 
 
  1. //which attribute should be applied here?  
  2. public class DocumentList:IList  
  3. {  
  4. private IList m_list = null;  
  5.  
  6. public DocumentList()  
  7. {  
  8. m_list = new List();  
  9. }  
  10.  
  11. #region IList Members  
  12.  
  13. public int IndexOf(Document item)  
  14. {  
  15. return m_list.IndexOf(item);  
  16. }  
  17.  
  18. public void Insert(int index, Document item)  
  19. {  
  20. m_list.Insert(index,item);  
  21. }  
  22.  
  23. public void RemoveAt(int index)  
  24. {  
  25. m_list.RemoveAt(index);  
  26. }  
  27.  
  28. public Document this[int index]  
  29. {  
  30. get  
  31. {  
  32. return m_list[index];  
  33. }  
  34. set  
  35. {  
  36. m_list[index] = value;  
  37. }  
  38. }  
  39.  
  40. #endregion  
  41.  
  42. #region ICollection Members  
  43.  
  44. public void Add(Document item)  
  45. {  
  46. m_list.Add(item);  
  47. }  
  48.  
  49. public void Clear()  
  50. {  
  51. m_list.Clear();  
  52. }  
  53.  
  54. public bool Contains(Document item)  
  55. {  
  56. return m_list.Contains(item);  
  57. }  
  58.  
  59. public void CopyTo(Document[] array, int arrayIndex)  
  60. {  
  61. m_list.CopyTo(array,arrayIndex);  
  62. }  
  63. public int Count  
  64. {  
  65. get { return m_list.Count; }  
  66. }  
  67. public bool IsReadOnly  
  68. {  
  69. get { return m_list.IsReadOnly; }  
  70. }  
  71. public bool Remove(Document item)  
  72. {  
  73. return m_list.Remove(item);  
  74. }  
  75. #endregion  
  76. #region IEnumerable Members  
  77. public IEnumerator GetEnumerator()  
  78. {  
  79. return m_list.GetEnumerator();  
  80. }  
  81. #endregion  
  82. #region IEnumerable Members  
  83. IEnumerator IEnumerable.GetEnumerator()  
  84. {  
  85. return ((IEnumerable)m_list).GetEnumerator();  
  86. }  
  87. #endregion  
  88. }  

分享題目:快速上手篇之WCF自定義集合
分享地址:http://www.5511xx.com/article/cojopgo.html