N-Tier Layer Approach

AspCoreGen 2.0 Razor generates code in a 3-tier (n-tier) architecture. A presentation tier (the client), middle tier (business objects), data tier (data access objects), and the database scripts such as stored procedures. Code is separated in different layers, see below:

  1. Front End (UI - Presentation Layer) Razor Pages, Razor Page Models, JavaScript, CSS, JQuery, etc. See more

  2. Web API (Middle-Layer, Optional). Optionally encapsulate calls to Business Objects when generating Web API code. See more

  3. Middle-Tier Class Files (Middle Layer) Business Logic Class Files, Models, etc. See more

  4. Data-Tier Class Files (Data Layer) using Linq-to-Entities - Entity Framework Core or Ad-Hoc SQL. See more

  5. SQL Scripts (Stored Procedures). See more

The generated middle tier objects (and data tier objects) is generated in another application (class library project) and can also be consumed by other clients. Clients could be a web form (.aspx), a win form, or a web service (.asmx, wcf), etc. Or better yet you can choose to generate the Web API (optional) and get all the other clients to access this extra layer instead.

The middle tier encapsulates all calls to the data access objects (data tier) so that calling a CRUD (create, retrieve, update, delete) and other operations are very easy and may only take one line of code for most parts. We made it even easier by generating and showing an example for each CRUD operation, for each table in your database, so you just copy and paste a call from your chosen client.

The data tier encapsulates all calls to the database. These are calls using Linq-to-Entities, or Stored Procedures, or Ad-Hoc SQL. Linq-to-Entities, or Stored Procedures, or Ad-Hoc SQL are also generated so you don't have to worry about writing T-SQL commands.

AspCoreGen Razor 3-Tier

* Please see notes.