Draft:StackPuz
This article, Draft:StackPuz, has recently been created via the Articles for creation process. Please check to see if the reviewer has accidentally left this template after accepting the draft and take appropriate action as necessary.
Reviewer tools: Preload talk Inform author |
This article, Draft:StackPuz, has recently been created via the Articles for creation process. Please check to see if the reviewer has accidentally left this template after accepting the draft and take appropriate action as necessary.
Reviewer tools: Preload talk Inform author |
Comment: Zero evidence of notability. DoubleGrazing (talk) 09:10, 18 April 2024 (UTC)
![]() | |
Developer(s) | Prasomsak Khunmuen |
---|---|
Initial release | 2024, |
Written in | Javascript |
Available in | English |
Type | Code generation, Scaffold (programming) |
License | Proprietary |
Website | stackpuz |
StackPuz is the Web Application Code Generator that will generate the Source code based on the user-defined database table. StackPuz uses the Model–view–controller (MVC) design pattern to create the user interfaces and control logic.[1] When the user scaffolds the table it will produce the Controller and its Views and let the user customize it later. The scaffolding technique will increase productivity when developing the standard data operations in web application projects.[2]
When working with StackPuz, the user needs to define the database table first. For example if the user has a product table like this.
<syntaxhighlight lang="sql"> CREATE TABLE Product (
id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, price DECIMAL(12,2) NOT NULL, active BIT DEFAULT 1 NOT NULL, create_date DATETIME, PRIMARY KEY (id)
); </syntaxhighlight>
The scaffolding operation will produce the source code of View, Model and Controller like these:
The View source code. <syntaxhighlight lang="html"> <form method="post" asp-action="Create" asp-route-ref="@(System.Net.WebUtility.UrlEncode(ViewData["ref"].ToString()))">
<label class="form-label" for="product_id">Id</label> <input id="product_id" name="Id" class="form-control form-control-sm" asp-for="@product.Id" type="number" required />
<label class="form-label" for="product_name">Name</label> <input id="product_name" name="Name" class="form-control form-control-sm" asp-for="@product.Name" required maxlength="50" />
<label class="form-label" for="product_price">Price</label> <input id="product_price" name="Price" class="form-control form-control-sm" asp-for="@product.Price" type="number" step="0.1" required />
<input id="product_active" name="Active" class="form-check-input" type="checkbox" value="true" checked=@(product==null ? false : product.Active) /> <label class="form-check-label" for="product_active">Active</label>
<a class="btn btn-sm btn-secondary" href="@ViewData["ref"]">Cancel</a> <button class="btn btn-sm btn-primary">Submit</button>
</form> </syntaxhighlight>
The Model source code. <syntaxhighlight lang="c#"> public partial class Product { [Key] [Required] public int Id { get; set; } [Required] [MaxLength(50)] public string Name { get; set; } [Required] public decimal Price { get; set; } [Required] public bool Active { get; set; } public DateTime? CreateDate { get; set; } } </syntaxhighlight>
The Controller source code. <syntaxhighlight lang="c#"> [HttpPost("Create")] [ValidateAntiForgeryToken] public async Task<IActionResult> Create([Bind("Id, Name, Price, Active")] ViewModel.Create.Product model) { if (ModelState.IsValid) { var product = new Product(); product.Id = model.Id; product.Name = model.Name; product.Price = model.Price; product.Active = model.Active; product.CreateDate = DateTime.Now; _context.Add(product); await _context.SaveChangesAsync(); return Redirect(WebUtility.UrlDecode(Request.Query["ref"].ToString())); } ViewData["ref"] = Util.getRef(Request, "/Product"); return View(model); } </syntaxhighlight>
Not only for CRUD operations, StackPuz also generates the source code for the User Authentication and User Authorization modules. so it can reduce the repetitive tasks when creating a new Web Application project.
StackPuz supports many Web Application Frameworks like React, Vue, Angular, Express, Laravel, .NET, Spring and also supports the most popular relational databases including MySQL, SQL Server, PostgreSQL and Oracle.
See also
References
- ^ "Definitions of Web-related terms MVC". 20 December 2023.
- ^ "ASP.NET Scaffolding Overview". 4 March 2022.