非常に長い時間、問題が発生しています。Microsoft.EntityFrameworkCore.dllで 'Microsoft.EntityFrameworkCore.DbUpdateException'タイプの例外が発生しました
public class Coordinate {
public int id {get;set;}
public int x {get;set;}
public int y {get;set;}
}
public class Planet {
public int id {get;set;}
public string name {get;set;}
public Coordinate coordinate {get;set;}
}
私は2つのモデルを作成しました。モデルPlanetは、モデルCoordinateを属性として持っています。 コードのどこかで座標を1つ作成し、それをデータベースに保存します。これは想像 座標:
Coordinate c = new Coordinate();
c.x = 1;
c.y = 2;
は、その後、私は私のデータベースに追加し、それが保存されます。
しかし、私は惑星を作成し、私は:
planet.coordinate = c;
そして私は、私は次のエラーを持ってそれをデータベースに追加しよう:
An exception of type 'Microsoft.EntityFrameworkCore.DbUpdateException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code
Additional information: An error occurred while updating the entries. See the inner exception for details.
私は属性を変更することができます知っていますpublic Coordinate coordinate
〜public int coordinate_id
ですが、代わりにCoordinateモデルでこれを実行します。
私はあなたの間違っているもので、より詳細な一見を与える内部例外を見て持つASP NET CORE 1.0
Cumps
は、(例えば、追加したばかりしかしで、惑星を追加するには、リレーションシップ・フィックスアップは同じ結果につながるはず座標)「詳細については、内部例外を参照してください。」それは何を言うのですか? – DavidG