0
我得到這個生成錯誤:模型後MVC不重建改變
Compiler Error Message: CS1061: 'Timesheet.Models.Time' does not contain a definition for 'Hours' and no extension method 'Hours' accepting a first argument of type 'Timesheet.Models.Time' could be found (are you missing a using directive or an assembly reference?)
...
Line 36: <td class="text-right">@String.Format("{0:N2}", client.Projects.SelectMany(project => project.Times).Sum(time => time.Hours))</td>
儘管在模型中有這樣的:
public Decimal Hours
{
get
{
return Convert.ToDecimal(Convert.ToDateTime(Minutes).TotalHours);
}
}
基本上,我剛剛更換了啓動&結束時間與分鐘字段,並更新小時定義使用分鐘,而不是從開始&結束時間計算(並將其從小時分鐘重新命名爲剛好幾小時)。但是模型中的這些變化並不是「正確構建」的。
事實上,如果我檢查模型的第36行上的智能感知,我會看到舊的字段。如果我在HoursSpent上按F12,它會將我帶到「Time [from metadata]」,而不是Time模型。所以這個構建不會構建。
難道你不需要一個安裝員幾小時,因爲總和? –
你能提供整個時間模型嗎? –