Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WCFServiceContract
- -------------------------------------------------------------------------------------------
- IService1 - interfejs
- -----------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- namespace WcfServiceContract
- {
- [ServiceContract] public interface IKalkulator
- {
- [OperationContract]
- double Dodaj(double n1, double n2);
- [OperationContract]
- double Odejmij(double n1, double n2);
- [OperationContract]
- double Pomnoz(double n1, double n2);
- }
- }
- ------------------------------------------------------------
- Service1 - klasa implementująca interfejs
- ------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- namespace WcfServiceContract
- {
- public class mojKalkulator : IKalkulator
- { public double Dodaj(double n1, double n2)
- {
- return n1 + n2;
- }
- public double Odejmij(double n1, double n2)
- {
- return n1 - n2;
- }
- public double Pomnoz(double n1, double n2)
- {
- return n1 * n2;
- }
- }
- }
- ------------------------------------------------------------
- WCFServiceHost
- ------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- namespace WcfServiceContract
- {
- [ServiceContract] public interface IKalkulator
- {
- [OperationContract]
- double Dodaj(double n1, double n2);
- [OperationContract]
- double Odejmij(double n1, double n2);
- [OperationContract]
- double Pomnoz(double n1, double n2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement