Sco*_*zie 7 asp.net-mvc code-generation
有谁知道一个好的/可用的ASP.NET MVC代码/解决方案生成器.理想情况下,它将从域模型构建,但从数据模型也可以接受.
如果你这样做,你能否回答以下问题:
如果没有你知道的那个,你认为这是社区缺少的东西,还是你认为不需要它?你想在一个功能中看到什么功能?
迫不及待地想听到你的答案......
谢谢斯科特
S#arp 架构包括使用 T4 的脚手架生成器。它根据模板模型定义生成模型、视图、控制器和测试。您将获得完整的 CRUD。由于它使用 T4(我想是 Visual Studio 模板语言),您可以根据需要扩展默认模板。
这是模板的示例:
EntityScaffoldingDetails entityScaffoldingDetails =
new EntityScaffoldingDetails("Organization.Worker");
/*
* Property names should be PascalCase.
* Do not include a property for Id as it will be included automatically.
*/
entityScaffoldingDetails.EntityProperties.Add(
new EntityProperty("FirstName", "string", "Joe", "[NotNull, NotEmpty]", true)
);
entityScaffoldingDetails.EntityProperties.Add(
new EntityProperty("LastName", "string", "Smith", "[NotNull, NotEmpty]", true)
);
entityScaffoldingDetails.EntityProperties.Add(
new EntityProperty("BirthDate", "DateTime", DateTime.Parse("1/1/1975"))
);
entityScaffoldingDetails.EntityProperties.Add(
new EntityProperty("Manager", "Employee", null, "[NotNull]")
);
///////////////////////////////////////////////////
// The first parameter should reflect the root directory of your solution
//ScaffoldingGenerator generator = new ScaffoldingGenerator(
//@"D:\Work\Project\", "Orders", entityScaffoldingDetails);
// Uncomment this line when you're ready for the scaffolding generator to fire...be sure to recomment after it completes to avoid accidental generating!
//generator.Run();
Run Code Online (Sandbox Code Playgroud)
一点补充:我不建议按原样使用它,因为,例如,我更喜欢控制器与 ViewModel 一起使用,而不是与实体一起使用。而且我不太使用脚手架。但它非常灵活,尽管你可能需要学习 T4。
| 归档时间: |
|
| 查看次数: |
8191 次 |
| 最近记录: |