Now, click on the project, select WCF Service application, and provide a name for the Service.
Now, click on the OK button. Then, you will get 3 files in Solution Explorer.
- IService.cs
- Service.svc
- Service.svc.cs
The following image shows the following files.
For inserting the data into the database, you need to write the following code in the IService1.csfile which contains the following two sections.
- OperationContract
- DataContract
The OperationContract section is used to add the service operations and a DataContract is used to add types to the service operations.
Iservice1.cs File
Now, we create a function in the OperationContract section of the Iservice1.cs file.