On twitter I read this post:
Ready for #zerotohero, Day Three? Today, write the post that's been on your mind, but had trouble getting out: buff.ly/19HvXFy—
WordPress.com (@wordpressdotcom) January 04, 2014
Since I have a wordpress blog and like a challenge, here is the daily post in my Zero to Hero sequence.
What’s on your mind
One of the reasons I started this blog was to share my (work) experience and give back to the internet. On my last project I migrated WCF services to be hosted in Windows Azure. With the right structure in place this was shockingly easy.
The services are designed with three layers:
- Service layer, implementation of the service contract,
- Business layer, checks the business rules,
- Data access layer, code to access the data (obvious)
Every layer is defined in an interface and contains a factory method to create the next layer. By making this factory method virtual the Azure implementation only needs to overwrite that and you’re done.
The data in Azure will be stored in Table storage. To access it I need to write the TableServiceEntity. The data access layer will use that with an CloudTableClient and TableServiceContext. Now my service is Azure ready.
In the design above you see the inheritance (horizontal) and the call hierarchy (vertical). Most of the work goes in the AzureDataAccess, because it does not inherit and all DataAccessContract implementation code must be written.
Also read my post about code generation for the design of the service.