![]() Public EmployeeController(IEmployeeRepository employeeRepo) Private readonly IEmployeeRepository _employeeRepo Public class EmployeeController : ControllerBase ![]() The final step is creating a controller to which our EmployeeRepository can be injected. We can make a corresponding C# class Employee for this table, like so: public class Employee So let's assume we have a table Employee with columns for FirstName, LastName, ID, and DateOfBirth. Step 2: Create an Employee Class and Repositoryįor this demo, I am not going to go over how to create a database or show a demo database with sample data I don't have one available and it's a pain to make one. With that installed, let's try creating a repository. In Visual Studio, you can do this by right-clicking on your project file and selecting Manage NuGet Packages and then search for the Dapper package, like so: First things first, we need to grab the NuGet package for Dapper.
0 Comments
Leave a Reply. |