以下に示すように、有効な関係を持つ次のテーブルを取得しました。
Report
------>ReprotDataSource
--------->SharePointDomain
ここで、次のことを試すと (新しく ReprotDataSource を選択した SharePointDomain にリンクする)、ID を持つ SharePointDomain に参照する代わりに、新しい SharePointDomain レコードが挿入されます (2)
//Create new Object
ReportDataSource rprtDS = new ReportDataSource
{
Name = rprtDSSelected.Name,
Parent = rprtDSSelected.Parent,
CreatedBy = Environment.UserName,
CreationDate = DateTime.Now,
Source = rprtDSSelected.Source,
Type = rprtDSSelected.Type
};
if (rprtDS.Type == "SP List")
//here is the issue
rprtDS.SharePointDomain = selectedSharePointDomain;//its id = 2
//Add to EntitySet
TheReport.ReportDataSources.Add(rprtDS);
TheReport.Save();
自分のIDを(2)に設定すると正常に動作します
説明はありますか。
前もって感謝します。