Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.57 KB

File metadata and controls

53 lines (35 loc) · 1.57 KB

Specification Pattern In .NET With Projection.

This demo project showcases an extended specification pattern with projection capability, specifically tailored for Entity Framework in .NET. It showcases how the specification pattern can be effectively utilized with projection or selecting during SQL query execution rather than mapping after data retrieval, this pattern is designed to handle selection/projection directly within the SQL query when implementing the repository pattern with specifications.

Setup

Prerequisite

  1. .NET 8 installed on your computer. You can download .NET 8 from the official website (https://dotnet.microsoft.com/download/dotnet/8.0).
  2. An integrated development environment (IDE) to write your code
  3. Git installed on your computer.

Initial setup

  1. Clone the project.
git clone https://github.com/haritha99ch/ExtendedSpecificationPattern-Example.git
cd ExtendedSpecificationPattern-Example
  1. Set Environment variables.
dotnet user-secrets set "SqlServerOptions:ConnectionString" CONNECTIONSTRINGS_DEFAULTCONNECTION --project ./src/ApplicationSettings/
  1. Install all the dependencies.

    dotnet restore
  2. Build the project.

dotnet build
  1. Add migrations and update database.
dotnet ef migrations add InitialMigration --project ./src/Infrastructure/
dotnet ef database update --project ./src/Infrastructure/

Make sure, dotnet-ef tool is installed with dotnet tool install --global dotnet-ef

  1. Run the project.
dotnet run --project ./src/Presentation/