model view controller - Is this class structure method correct/desireblable? (MVC/C#) -


I am creating an MVC application which is a bit more complicated than what I usually do and I A new class structure Basically a lot is going to read. Just 5-10% of the operations will be included / updated with the database.

For this reason, I am thinking of making Base DTO classes which will come back from a database layer. Then, merchandise items will be acquired from the DTO class so that the infrastructure can expand with all the verification and business rules.

Example:

  Namespace Project. DTO {public class employee {public string name; Public string alias; ...}} namespace project {public class employee: project.dtd.mplavi {public beel isisid ()} {...}}}   

Is this a good way? I have not even thought of how to use them within MVC because the model classes must be applied to the "right" way. I believe that I can create model class inherited from DTO objects ... but I have uncertainty.

I will also need to handle all verification functions with some kind of interface, such as

I would probably use a completely different approach. My primary thoughts are:

  • I make poor coupling between classes So, my model classes will not be available to my DTO object.
  • I will probably not be involved in verification in my model sections

    This will start the following structure:

      Namespace Project. DTO {public class employee {public string name; Public string alias; ...}} namespace project {public class employee {public string name {get; Set; } Public string aliases {get; Set; }}}   

    When it comes to validation logic, then I will create an interface for validation logic, which is injected into ample class: < / P>

      Public Interface IValidator & lt; T & gt; {Bool isivalid (T objectToInspect); } Public Class Employees {Private Redoni IValidator & lt; Employee & gt; Verifier; Public Employee (IVADATOR and Lieutenant Employee & gt; Verifier) ​​{this.validator = validator; } Public string name {get; Set; } Public string aliases {get; Set; } Public Bull ISIIDID () {Return Verifier} ISI Valid (this); }}   

    This opens your design for a full range of features, including better support for IoC containers and testing.

Comments