S#arp Architecture 포함에게 비계 발전기를 ... 당신의 답변을 듣고 기다릴
감사 할 수 없습니다. 템플릿 모델 정의에서 모델, 뷰, 컨트롤러 및 테스트를 생성합니다. 당신은 완전한 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();
하나의 작은 또한 : 예를 들어, 내가 컨트롤러를 선호하는 것, 때문에 나는 하지 뷰 모델 작업을 그대로을 사용하는 것이 좋습니다 것이 아니라 실체 여기
템플릿의 예 . 그리고 나는 비계를 많이 사용하지 않습니다. 그러나 T4를 배워야 할지도 모르지만 꽤 유연합니다.
Jon Skeet이 훌륭한 코드 생성기임을 알게되었습니다. –