I'm fairly new to C# and .NET as a whole and I want to create an application, I have strong experience in Java, Hibernate and using MVC frameworks like Spring.

I want to create an application that will have the following purpose:

  1. Be accessible by people that can login to it (active directory)
  2. Store data that is relevant for the user logged in and be able to create events
  3. Events are persisted to a central database for all users, and back-end stuff can be done like calculations and checking
  4. Be able to see events, request events and also some users will have a management permission to be able to see others' events

The client-side application will need to be in C# running on Windows and will probably be using a WPF application to be able to access/insert data. I will also be using SQL Server for persistence but where I'm thrown off is where the service layer should exist.

The kind of framework I'm looking for invovled an N-Tier architecture, where I have a presentation layer (client), service layer (?1) and a persistence layer (?2).

?1 - I want to gather some suggestion on what I can use for creating a service layer. Would it be worth for me to use ASP.NET to create a Web API that I can access from my client? So I can communicate with the Web-API to access and add data, which in turn will persist?

Something of this sort:

architecture diagram

Is this the correct way of thinking about this?

?2 - I would assume it would depend on the service layer to determine where the persistence layer should exist. I've had a look at Entity Manager and it seems like a good way of handling database, objects and entities. If my service layer exists on a web api of some sort, I believe that I could tie in the persistence layer behind that which would give me the ability to handle data and it would be good from a security point of view(?)

I hope there is enough information here, I am not interested in code or programs. I'd appreciate it very much if I could receive some sort of a pointer to what architecture I should use for an application like this and what semantics would be useful.

  • 1
    Your diagram seems reasonable. – Robert Harvey Sep 20 '16 at 20:18
  • Did you give a look at ASP.Net MVC and NHibernate ? – Philippe Sep 22 '16 at 19:24

I agree with the comment, your diagram seems reasonable. https://docs.asp.net/en/latest/tutorials/first-web-api.html will walk you through using ASP.NET Core and Entity Framework to create a simple web API which would probably work great for your purposes. When you build this, you'll wind up with a similar 3-tier architecture. The other nice part is with Entity Framework and ASP.NET as your database grows you'll have control over what's visible through the API and what isn't.

1 - Client Programs - Your client programs will sit on the mobile devices like you want, and be quite happy to talk to your web api.

2 - Web API / Service Layer - This guy sits right where you want it to, on hte web talking to a back-end database. ASP.NET gives you a ton of control over what your API looks like (I prever userid/object/objectidentifier but you can do whatever you want after some fiddling) and what rules you have. Be sure to look up where in its process ASP.NET intercepts HTTP requests. I don't recall it off hand, but you do have a chance to do authentication for keys if you choose to (I think its literally on the action filter?).

3 - Database - He chills in the back with all the calculations and ordering you may want to do. My advice with APIs in general is remember that databases are amazing at ordering, sorting, and searching data. They're also generally much faster than C# is at doing these things, so if you can offload as many of these tasks as you can to the boss.

Otherwise, since it looks like you're scheduling events I'd suggest looking at RabbitMQ and Quartz libraries for handling firing and processing of events. We've used this stack very successfully at work to do e-mail lists and alerts, so you may find them useful. Quartz and RabbitMQ also come out-of-the-box usable together, which is awesome. My weapon of choice for dealing with RESTful APIs is RestSharp, but you may find you prefer something else.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.