When programming in C # using Visual Studio 2008, I often want “automatic” code generation. If possible, I would like to achieve this by making my MSBuild solution file look at Rake, which will call the Ruby code to generate the code, since the generated files will automatically appear in my solution.
Here is one business example (out of many possible examples that I could name) where this type of automatic code generation would be useful. In a recent project, I had an interface with some properties that contained dollar amounts. I need a second interface and a third interface that has the same properties as the first interface, except that they were "qualified" with the name of the business unit. Something like that:
public interface IQuarterlyResults
{
double TotalRevenue { get; set; }
double NetProfit { get; set; }
}
public interface IConsumerQuarterlyResults
{
double ConsumerTotalRevenue { get; set; }
double ConsumerNetProfit { get; set; }
}
public interface ICorporateQuarterResults
{
double CorporateTotalRevenue { get; set; }
double CorporateNetProfit { get; set; }
}
In this example, there is a "consumer business unit" and a "corporate business unit." Each property in IQuarterlyResults becomes the property of "Corporate" + [property name] on ICorporateQuarterlyResults, as well as for IConsumerQuarterlyResults.
, IQuarterlyResults Corporate? , , , 100 , , " " , "ConsumerNetProfit".
. , .
: Ruby ERB , Rake . , , MSBuild Rake, Rake/Ruby "" , . , , MSBuild VS.NET.
- - ? ? , , ..?
!