Generic Type in Repository – .NET MVC Part

Step 2. Create the new repository class file under the Infra project. The new repository class file name sets “GenericTypeRepository.” The GenericTypeRepository class must inherit the IGenericTypeRepository interface class’s method. It also does the same as the thing that marks the note above the method name position.

Fig 3. Infra project’s solution explorer
Fig 4. GenericTypeRepository repository class file source code

Note: If you want to see the complete source code about the new interface class file, please, click my GitHub repository.

Step 3. Create new controller files under the web project’s Controller folder. The controller file name sets “GenericTypeController.” Create view files under the web project’s Views folder.

Fig 6. GenericTypeController controller file source code

Note: If you want to see the complete source code about the new interface class file, please, click my GitHub repository.

Leave a Reply