클래스 객체와 함께 웹 서비스를 사용하는 방법이 궁금합니다. 고객, 작업, 프로젝트 등의 BOL에 클래스 객체가 있습니다. ADO.net을 사용하여 데이터 영역에 연결합니다. 그냥 내 프로젝트에서 웹 서비스를 사용하기 시작했다. "WebServices"라는 폴더를 추가했다. 그리고 BOL의 메소드를 사용하여 웹 서비스의 Json 객체에 데이터를 가져오고 데이터를 가져왔다. WebServices를 직접 데이터베이스에 연결하거나 BAL을 사용하여 Json으로 가져온 후 데이터를 가져와야하는지 궁금합니다.웹 서비스 및 클래스 객체
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Compudata_ProjectManager.CodeFile.BOL;
using System.Web.Script.Services;
namespace Compudata_ProjectManager.WebServices
{
/// <summary>
/// Summary description for CustomerList
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class CustomerList : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<Customer> FetchCustomersList(string name)
{
var cust = new Customer();
var fetchNames = cust.GetAllCustomerNames().Where(n => n.FirstName.ToLower().StartsWith(name.ToLower()));
return fetchNames.ToList();
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<Location> FetchCustomerAddressList(string name)
{
var Addresses = new Location();
var fetchAddress = Location.GetAllAddress();
return fetchAddress.ToList();
}
}
}