问题
I am trying to generate CRUD operations for entities of my database tables like with respective endpoints to consume.
It is same as the visual studio generates boiler plate code for Authentication(Account controller),and also crud operation in the form of whole package.
I have came across t4 templates but not getting how to use it to generate crud operations for my database table entities.
I am also trying to generate whole application package with Application name,references(dll),Controller etc.. like how visual studio is generating boiler plate code for CRUD operations for entity framework.
I will pass sql server name,database name,tables for which i want to generate CRUD operations.
I want to generate this on demand with my console application so it should return whole application packages with reference s(all dll) so then i will create zip of that packages and return to user.
For Eg:I want to generate my whole apllication package based on "Application name" as shown in below WebApplication3 project which contains References,Controller which contains crud operations
Can anybody tell me how to do this?
回答1:
You could use a generator like Telosys, it has a C# MVC Template working with entity framework.
If you have a database model, you can pass it to the generator with this template and it will generate a working CRUD application written in C# that you can reuse in your project.
http://telosys.org/
Template to use : https://github.com/telosys-templates-v3/telosys-template-mvc-csharp
来源:https://stackoverflow.com/questions/49209315/how-to-generate-whole-boiler-plate-code-for-crud-operations-like-visual-studio-u