MVC Asp Net 6 System Design

1. Try to design your codebase to be Type Free, agnostic by utilizing Polymorphism.
   - Use Base Classes when possible, this makes it really helpful to customize or include another object in one single class logic.
   - The best way to define Interfaces are :

        - Create a base Interface IMyLovelyBaseInterface<T> where T : class{
        - then create specific type Interface and enherit the Base Interface like so:

           interface IMyOwnInterface : IMyLovelyBaseInterface<MyLovedlyTypeOfClass>{
             myFunction(); //This interface will contain all functions defined in the base interface.

[NB] You can register your IMyOwnInterface and it's consuming repository in a Startup.cs like so:
        services.AddScopped<IMyOwnInterface,MyConsumingRepository>(); // Enjoy the Dependency Injection the DI Container provides.

System Design

© 2024 - ErnesTech - Privacy
E-Commerce Return Policy