-1

I would like to learn AngularJs. I'm familar with ASP.NET MVC. I'm going to write some web app and I want to use AngularJs in client side and ASP.NET MVC 5 in server side.

I project solution:

  • Project Web - client side ( AngularJs)
  • Core (DAL, repositories, business layer) (C#)
  • Test

Is is good architecture ? What do you think about it ?

1 Answer 1

1

I would use:

  • ASP.NET MVC for url routing and page rendering (plus localization if you need it).
  • Angular JS for client side development.
  • ASP.NET WebApi for Ajax requests.

Business and Data Access Layers will be developed in external projects, of course in C#.

My personal tools for testing are NUnit, NSubstitute (mocking library), FluentAssertions and AutoFixture for text data generation.

Think also about using an IoC container and implement your project using dependency injection of components. I'm personally a fan of Autofac, but there are other options that you can consider.

I would also suggest you to give a look at NancyFx, a lightweight framework that can be used in place of MVC and WebApi. More information here: Benefits of using NancyFx?

To summarize the solution layout:

  • One project will contain MVC and Web API controllers and angular script file
  • Another project will contain the Business Layer (I prefer to call it Domain Layer)
  • Another project will contain the Data Access Layer
  • Each project will have a corresponding test project, following the xUnit conventions.

If you apply Inversion of Control, you can define all comunication interfaces in the domain layer and then make the UI layer and the Data Access Layer reference it.

Sign up to request clarification or add additional context in comments.

6 Comments

To sum up, you suggest: ASP.NET MVC, AngularJs, WebApi - is it one project right ? What do you think about xUnit ?
Yes, the MVC application will be very simple, only controllers (one if you have a single page application, more if you have more single page applications which is normal) and will be responsible for routing and rendering (you will probably don't define any model inside it). Angular controllers and views will be javascript file defined inside the MVC application. Anyway, The MVC project can contain both the MVC and the API controllers, that will be used by Angular controllers to call server side functions.
xUnit is fine, but to be honest I never used it. I fell good with nUnit :-)
And if you plan to use an IoC container (which I strongly suggest) take car to know HOW to use it. I strongly suggest you to start from Mark Seemann's blog (blog.ploeh.dk) and book (manning.com/seemann). You will avoid very dangerous mistakes :-)
Okay, so I'm going to create 3 project in one solution then. Thanks
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.