1. Data Load가 되지 않을 때 Data Connection을 설정할 때 다음과 같이 설정하여 Sensitive data가 빠지지 않았나 확인한다.
Yes를 선택하거나 , Web.config 파일에서 빠진 부분을 추가한다.
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Customer.csdl|res://*/Customer.ssdl|res://*/Customer.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=ID="" providerName="System.Data.EntityClient" />
</connectionStrings></configuration>
</connectionStrings></configuration>
2. select(load) opration은 실행되지만 update, insert ,delete operation에서 submit_changed()에서 에러가 발생한다면
Domain Service 파일에 다음 함수를 오버라이드 해서 errorinfor 에서 서버 에러원인을 찾는다.
protected override void OnError(DomainServiceErrorInfo errorInfo)
{
//Log exception errorInfo.Error
}
Entity로 사용한 DB table Primary key 없다면 sub_changed가 일어나지 않으므로 Key를 꼭 등록하여야 한다.
3. Client 에서 Submit_changed 가 일어난 이유 call back 함수를 이용해서 디버깅 하는 방법
SubmitChanges(OnSubmitCompleted, null); 이용한다.
private void BtnAdd_Click(object sender, RoutedEventArgs e)
{
CustomerResistartionWindow addCus = new CustomerResistartionWindow();
addCus.Closed += new EventHandler(addCus_Closed);
addCus.Show();
}
// Entity 추가
void addCus_Closed(object sender, EventArgs e)
{
CustomerResistartionWindow cusWidow = (CustomerResistartionWindow)sender;
AWWIPCUSTOMERUSERLIST cust = (AWWIPCUSTOMERUSERLIST)cusWidow.NewCustomer;
if (cust != null)
{
CustomerContext.AWWIPCUSTOMERUSERLISTs.Add(cust);
CustomerContext.SubmitChanges(OnSubmitCompleted, null);
tbValidation.Text = cust.CUSTOMER + " User List Added!";
}
}
{
CustomerResistartionWindow cusWidow = (CustomerResistartionWindow)sender;
AWWIPCUSTOMERUSERLIST cust = (AWWIPCUSTOMERUSERLIST)cusWidow.NewCustomer;
if (cust != null)
{
CustomerContext.AWWIPCUSTOMERUSERLISTs.Add(cust);
CustomerContext.SubmitChanges(OnSubmitCompleted, null);
tbValidation.Text = cust.CUSTOMER + " User List Added!";
}
}
// entity 제거
private void BtnDelete_Click(object sender, RoutedEventArgs e)
{
AWWIPCUSTOMERUSERLIST cust = (AWWIPCUSTOMERUSERLIST)dataForm1.CurrentItem;
CustomerContext.AWWIPCUSTOMERUSERLISTs.Remove(cust);
CustomerContext.SubmitChanges(OnSubmitCompleted, null);
tbValidation.Text = cust.CUSTOMER + " User List Deleted!";
}
// Entity 수정
private void BtnDelete_Click(object sender, RoutedEventArgs e)
{
AWWIPCUSTOMERUSERLIST cust = (AWWIPCUSTOMERUSERLIST)dataForm1.CurrentItem;
CustomerContext.AWWIPCUSTOMERUSERLISTs.Remove(cust);
CustomerContext.SubmitChanges(OnSubmitCompleted, null);
tbValidation.Text = cust.CUSTOMER + " User List Deleted!";
}
// Entity 수정
private void BtnModify_Click(object sender, RoutedEventArgs e)
{
if (CustomerContext.HasChanges)
{
AWWIPCUSTOMERUSERLIST cust = (AWWIPCUSTOMERUSERLIST)dataForm1.CurrentItem;
dataForm1.CommitEdit();
CustomerContext.SubmitChanges(OnSubmitCompleted, null);
tbValidation.Text = cust.CUSTOMER + " User List Modified!";
}
}
{
if (CustomerContext.HasChanges)
{
AWWIPCUSTOMERUSERLIST cust = (AWWIPCUSTOMERUSERLIST)dataForm1.CurrentItem;
dataForm1.CommitEdit();
CustomerContext.SubmitChanges(OnSubmitCompleted, null);
tbValidation.Text = cust.CUSTOMER + " User List Modified!";
}
}
// Submit operation의 결고 객체로 확인
private void OnSubmitCompleted(SubmitOperation so)
{
if (so.HasError)
{
MessageBox.Show(string.Format("Submit Failed: {0}", so.Error.Message));
so.MarkErrorAsHandled();
}
CheckChanges();
}
private void OnSubmitCompleted(SubmitOperation so)
{
if (so.HasError)
{
MessageBox.Show(string.Format("Submit Failed: {0}", so.Error.Message));
so.MarkErrorAsHandled();
}
CheckChanges();
}
// Entity Set 변화를 확인
private void CheckChanges()
{
EntityChangeSet changeSet = CustomerContext.EntityContainer.GetChanges();
string text = changeSet.ToString();
bool hasChanges = CustomerContext.HasChanges;
}
{
EntityChangeSet changeSet = CustomerContext.EntityContainer.GetChanges();
string text = changeSet.ToString();
bool hasChanges = CustomerContext.HasChanges;
}