I spent most of this weekend, researching different ways to achieve my project. There are certain things that I know I want to do:
Adopt a Three Tier Approach.
- Multiple Clients (Including a Website)
- A middle service layer that all the clients talk to which can read from the database but not update.
- A back end which is the only part of the solution allowed to update the database
The communication between the middle tier and the back end tier will be via the Azure Service bus.
I want the user of the application to be able to log in to the various client using their Windows Account/Google/Facebook ID’s.
With this in mind I was looking into ways to achieve these goals. I was mainly concentrating on what the middle service tier should be.
I wanted something that will make it easy to implement clients on non Microsoft platforms which drew me towards using the new ASP.Net MVC Web API. The downside of this is there is no metadata to describe the service which makes the client much harder to write. After a few discussions with a colleague, they suggested using WCF OData service which should allow making clients easy on the windows side. (Automatic generation of model classes when adding a service reference)
But I’m still open to suggestions from anyone reading this if they think there may be a better way.
The solution structure for the project as it stands now will be:
Tyrannt.Model (Holds the Code First EF Classes)
Tyrannt.Backoffice (Windows Azure Worker Role – The back end tier)
Tyrannt.OData (Web Role – the Middle WCF OData tier)
Tyrannt.Website (First client – will consume the OData service)
I would also like to make use of database migrations that are in Entity Framework 5. Which also brings up another question which it’s been hard to answer. Where is the best place to put the Database context. An easy solution would be to put one in both the Backoffice and OData projects but that means maintaining two separate classes that basically do the same job)
I’ve seen some posts about not having the database context in the same project as the Model classes. I’m trying to work out the best way to do this and still allow database migrations.
Feel free to comment this posts with suggestions ideas or even telling me that I’ve got it all wrong ;-).
