11. User Model:
public class User : Entity
public string Name { get; set; }
public string Password { get; set; }
public string PasswordSalt { get; set; }
public string AccessToken { get; set; }
12. User Api Model:
public class User
public string Id { get; set; }
public string Name { get; set; }
public string AccessToken { get; set; }
13. Use AttributeRouting nuGet Package
public class SampleController : ApiController
{
[GET("Sample")]
public List<Tweet> Index() { /* ... */ }
[POST("Sample")]
public void Create() { /* ... */ }
[PUT("Sample/{id}")]
public void Update(int id) { /* ... */ }
[Route("Sample/Any-Method-Will-Do")]
public string Wildman() { /* ... */ }
}
16. Pros
• Decoupling
• Easy Testing, Isolating and Mocking
Cons
• Complicates the code
• New set of bugs
17. Add StructureMap.MVC4 nuGet Package
to the website
Build classes with IoC in mind
Add Repository Registry
Add Registry to Ioc.cs in Depedency
Resolution folder
18. Not a part of Asp.Net.
It’s just a best practice
Allows:
• Code reuse
• Decoupling
• IoC/Dependency Injection
Current Standard – Low learning curve for
developers