Skip to content

benpriebe/ServerRI

Repository files navigation

#ServerRI#

An fully functional server side webapi solution.

The architecture for this server side solution incorporates the following patterns and technologies:

  • Entity Framework 5x (Code First)
  • Repository Pattern
  • Unit of Work Pattern
  • IoC (using AutoFac)
  • A Service API using DTOs (models) and AutoMapper
  • .NET WebAPI REST architecture (with REST-RPC extensions when needed).

The solution is very enterprisey with lots of layers to enable extreme abstraction and unit testing.

It aims to demonstrate how to handle:

  • dependency injection (autofac)
  • exceptions
  • logging (common.logging)
  • validation
  • unit testing (mocking with moq)
  • e2e testing (end-to-end)

NOTE: If you're looking for something simpler I suggest you move along.

##Pre-Requisites:##

  • .Net 4.5
  • Visual Studio 2012
  • SqlServer Express 2012

##Acknowledgements## A big thanks to Gerrod, Karl, OJ and Michael for all their help in getting this put together. Whether it be through code contribution or advice.

##Getting Started:##

###Database### Attach the Data/AdventureWorksLT2012_Data.mdf to an instance of SqlServer Express 2012 and call it "AW". Alternately, change connection strings to work with your own configuration (Core/Configuration/ConnectionStrings.config)

###Logging### Modify Core/Configuration/Log4Net.config SMTPAppender to use your own smtp server.

Once you've completed these steps, you should be able to run the unit test projects and also fire up the webapi project and hit it.

###REST API URLS###

(hey! 3 acronyms in a row - sweet)

note: you can view the exception details at http://localhost:60000/elmah.axd and you should also receive an email if you configured your Log4Net SMTPAppender correctly.

{
 name : "iPhone7",
 productNumber : "a1234",
 listPrice : 799.00,
 standardCost: 384.23
}
{
 listPrice : 799.00,
 standardCost: 384.23
}

note: pass in a "accept-language: en-au" request header to get back a localized error message.

{
 name : "iPhone7",
 productNumber : "1",
 listPrice : 799.00,
 standardCost: 384.23
}
{
 name : "iPhone7",
 productNumber : "HL-U509",
 listPrice : 99.00,
 standardCost: 99
}
{
  standardCost : 100.00,
  listPrice : 999.00
}
{
  standardCost : 100.00,
  listPrice : 999.00
}

About

An fully working overly engineered server side webapi solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages