dynamic soft code generator

Posted by tzul at 2020-03-10

I won't introduce the basic functions, mainly using an example to generate and use the three-tier architecture code of maticsoft.

When we notice that there is a relationship between tables, let's take a look at the code generated by maticsoft. It is found that there is roleid in nkuser's model. We know that in practical applications, roleid is not displayed to users, but rolename or rolenamedesc. It is not possible to use roleid to query the role table every time you find roleid. Here are several methods.

(1) : view. View of the article can go to see the blog Garden inside this article, I will not repeat the specific.

Then we use the single table code generator in maticsoft to generate three layers of code.

Set the namespace, class name, and copy the generated class file to the project directory ~ ~ so that okay is done.

(2) : compared with (1), this work is done after a little bit, table or that table. After the model is generated, the roleid type is changed to role. Such a record contains user information and role information. adopt

It can also be implemented. Of course, the second one needs to modify Bll and DAL.