Similarly, when you amend the code in the ReadList() method, your new code might look like the following:
…
public static List<Entity1> ReadList()
{
myAzureSvc.Service1Client myWCFProxy = new myAzureSvc.Service1Client();
var salesData = myWCFProxy.getAllCustomers();
List<Entity1> mySalesInfoList = new List<Entity1>();
foreach (var item in salesData)
{
Entity1 tempEntity = new Entity1();
tempEntity.Identifier1 = item.tempCustID;
tempEntity.tempCustTitle = item.tempCustTitle;
tempEntity.tempCustFirstName = item.tempCustFirstName;
tempEntity.tempCustLastName = item.tempCustLastName;
tempEntity.tempCustEmail = item.tempCustEmail;
tempEntity.tempCustPhone = item.tempCustPhone;
mySalesInfoList.Add(tempEntity);
}
myWCFProxy.Close();
return mySalesInfoList;
}
…
In both cases, you can see the WCF service being implemented and then consumed within the context of your BDC Metadata Model project.
When you’re done amending the code in the ReadItem() and ReadList() methods, you deploy to SharePoint by right-clicking the project and selecting Deploy. You can then use the new external content type (which is the output of the project) to create a new external list. This list calls the Azure service at runtime, then, at two times. The first time is when it loads the list (it calls the ReadList() method which subsequently calls the getAllCustomers() web method). The second is when you click on a particular item to view a specific list item (it calls the ReadItem() method which subsequently calls the getACustomer() web method).
Leverage Azure to Create Applications for SharePoint
This article introduces some of the ways in which you can integrate SharePoint 2010 and Azure. This integration is from an application (or consumptive) perspective as opposed to building and hosting SharePoint on Azure. That said, there are some very powerful ways to integrate SharePoint and Azure. Further, SharePoint provides native support for service and data integration. For example, you can manage SQL Azure credentials using the Secure Store Service, and the BDC Metadata Model provides native support for cloud-based service consumption for external lists.
This article also provided a high-level discussion of a specific example of Azure and SharePoint integration. Specifically, it discussed a WCF service that was deployed to Azure and then integrated and consumed with SharePoint using BCS—a new set of services to SharePoint 2010 that facilitate external data and system integration with SharePoint.
You can build many different interesting and compelling integrations with SharePoint, and leveraging Azure certainly expands your opportunities as a developer and as a company trying to create applications for SharePoint.
Getting Started with Azure and SharePoint
To find out more about how you can get started, check out the following resources:
Windows Azure Portal: www.windows.azure.com
Azure Channel 9 Learning Center: http://channel9.msdn.com/learn/courses/Azure/
SharePoint Channel 9 Learning Center: http://channel9.msdn.com/learn/courses/SharePoint2010Developer/
MSDN SharePoint Developer Center: http://msdn.microsoft.com/en-us/sharepoint/default.aspx