所以。實體框架不生成關聯屬性
我無法解決這個小問題。
我有幾個班,它都很好,很好。直到現在。我現在添加了另一個類(MatchResult),它可以工作。
但是當我嘗試做正確的關聯關係:
它失敗,出現運行時異常。
錯誤:
Schema specified is not valid. Errors:
The relationship 'DbModel.FK_ProductPrice' was not loaded because the type 'DbModel.Product' is not available.
The following information may be useful in resolving the previous error:
The required property 'MatchResults' does not exist on the type 'PriceMonitor.Model.Product'.
The relationship 'DbModel.FK_WebshopProduct' was not loaded because the type 'DbModel.Product' is not available.
The following information may be useful in resolving the previous error:
The required property 'MatchResults' does not exist on the type 'PriceMonitor.Model.Product'.
看來 - 因某種原因 - 即EF不會產生對產品類中的MatchResults屬性。
這種方法適用於我曾經使用EF製作過的每一個班級。到現在爲止。
您是否檢查過該屬性實際上是在代碼中生成的。你可以嘗試強制生成代碼嗎? – Pawel
如何強制重新生成代碼? –
沒關係,我找到了答案:-) –