Tuesday, October 15, 2024

Creating multiple Layers Application in Visual Studio

Let’s build an ASP.NET Core MVC application with a clean architecture, separating concerns into multiple layers:

  • Business Logic Layer (BLL)
  • Data Access Layer (DAL)
  • Web API Layer
  • Presentation Layer (MVC)
  • Test Layer (Unit Testing)

The project will be organized as follows:

Project Structure

  • MyApp.Business (Business Logic Layer - BLL)
  • MyApp.Data (Data Access Layer - DAL)
  • MyApp.WebAPI (Web API Layer)
  • MyApp.Web (Presentation Layer - MVC)
  • MyApp.Tests (Test Layer)

Wednesday, June 12, 2024

LINQ Code and Tips

 LINQ Code and Tips


Entity Framework - Get a value of Column

pageTitle = db.Pages.Where(x => x.PageId == pageId).Select(x => x.PageTitle).SingleOrDefault();

Entity Framework - How to Get the current maximum value of a column

pageId = db.Pages.Max(x => x.PageId);