每当我开始学习新技术或语言时,我倾向于查看一些"真实世界"应用程序的源代码.我发现它们对于理解常见的,特定于技术的体系结构,习语以及如何/使用流行的库是非常有用的.我最近开始学习ASP.NET MVC,但还没有真正找到好的开源应用程序.我想知道你是否知道一些有价值的东西.
我对使用IoC依赖注入库(如Windsor或StructureMap)的MVC应用程序非常感兴趣.
在ASP.NET MVC的当前示例中,我看到了非常基本的实体,使用简单的CRUD方法.
但我不确定如何处理更高级的模型.让我举个例子:
我们有一个车库网站.车库有:
carpartsEmployeesCustomersCars 这包括车库里的所有车辆现在让我们来看看car,汽车可能有一个在汽车employees上工作的集合(从原始employee类派生,添加一些额外的道具将他绑在汽车上),一组carparts已被替换(也派生,例如添加) SerialNr和ReplacementDateprop),当然customer也是拥有汽车的客户的支柱.
现在rest我希望看到以下内容:
/cars/423 [get] //show car # 423
/cars/423/edit [get] //shows the edit form (ajax enabled, so also shows the other props)
/cars/423/carparts [get] //gets the carparts inside the car
/cars/423/carparts/32/edit [post] //updates that specific carpart inside the specific car
/cars/423/employees [get] //gets the employees who worked on the car
/inventory [get]
/inventory/1234/edit [get] //gets …Run Code Online (Sandbox Code Playgroud)