■ 서비스 계약 인터페이스를 상속하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
using System; using System.Collections; using System.ServiceModel; namespace TestProject { /// <summary> /// 상점 인터페이스 /// </summary> [ServiceContract(Namespace="http://company.com/bookstore")] public interface IBookStore { //////////////////////////////////////////////////////////////////////////////////////////////////// Method #region 주문하기 - Order(userID, isbn, amount) /// <summary> /// 주문하기 /// </summary> /// <param name="userID">사용자 ID</param> /// <param name="isbn">ISBN</param> /// <param name="amount">수량</param> /// <returns>주문 ID</returns> [OperationContract] int Order(string userID, string isbn, int amount); #endregion #region 취소하기 - Cancel(orderID) /// <summary> /// 취소하기 /// </summary> /// <param name="orderID">주문 ID</param> /// <returns>처리 결과</returns> [OperationContract] bool Cancel(int orderID); #endregion #region 검색하기 - Search(title) /// <summary> /// 검색하기 /// </summary> /// <param name="title">제목</param> /// <returns>제목 배열</returns> [OperationContract] string[] Search(string title); #endregion } /// <summary> /// 상점 2 인터페이스 /// </summary> [ServiceContract(Namespace="http://company.com/bookstore2")] public interface IBookStore2 : IBookStore { //////////////////////////////////////////////////////////////////////////////////////////////////// Method #region 검색하기 2 - Search2(title) /// <summary> /// 검색하기 2 /// </summary> /// <param name="title">제목</param> /// <returns>제목 배열</returns> [OperationContract] string[] Search2(string title); #endregion } } |