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.

Edit this Article
System Design System Design published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy