Code Snippet: Implementing a BulkSpecificFinder
마지막 수정 날짜: 2010년 4월 19일 월요일
적용 대상: SharePoint Server 2010
이 문서의 내용
Example for a .NET Connectivity Assembly
Example for an ASP.NET Web Service
Example for a WCF Service
The following code examples show how you can implement a BulkSpecificFinder method instance in a .NET connectivity assembly and in a Web service.
Example for a .NET Connectivity Assembly
public Customer[] GetBulkCustomersByID(String[] ids)
{
List<Customer> custList = new List<Customer>();
foreach (Customer customer in customers)
{
if (Array.Find(ids, id => id == customer.CustomerID &&
!customer.IsDeleted) != null)
{
custList.Add(customer);
}
}
return custList.ToArray();
}
Example for an ASP.NET Web Service
[WebMethod]
public Customer[] GetBulkCustomersByID(String[] ids)
{
List<Customer> custList = new List<Customer>();
foreach (Customer customer in customers)
{
if (Array.Find(ids, id => id == customer.CustomerID &&
!customer.IsDeleted) != null)
{
custList.Add(customer);
}
}
return custList.ToArray();
}
Example for a WCF Service
The following code shows the operation definition in the service contract interface.
[OperationContract]
Customer[] GetBulkCustomersByID(string[] ids);
The following example shows the implementation of the method instance.
public Customer[] GetBulkCustomersByID(String[] ids)
{
List<Customer> custList = new List<Customer>();
foreach (Customer customer in customers)
{
if (Array.Find(ids, id => id == customer.CustomerID && !customer.IsDeleted) != null)
{
custList.Add(customer);
}
}
return custList.ToArray();
}