Hi,
I just got the latest of 3.0, the Aug 5th release, regenerated and still same issue...
Yes, the PK field is set.
With a bit more tracing, i've seen more weird stuff:
Here is the TestMethod:
[TestMethod]
public void WCFUpdateIssue()
{
UpdateIssueDTORequest request = new UpdateIssueDTORequest();
UserProxy clientProxy = new UserProxy();
IssueEntity newIssue = new IssueEntity();
newIssue.IssuePk = 1012;
newIssue.IsNew = false;
newIssue.Title = "Should be updated!";
request.Issue = newIssue;
string result = clientProxy.UpdateIssue(request);
Assert.IsTrue(result == "Should be updated!");
}
At the point the clientProxy.UpdateIssue() method is called, all of the values are set correctly. The Request object is a data transfer object (DTO) that is just a public field of type "IssueEntity". I am creating a new instance of that, populating the fields and assigning it to the DTO and passing it along.
The next stop is a business logic layer. At this point, all fields are correct also. It then passes the same object to the data access layer.
public string UpdateIssue(UpdateIssueDTORequest request)
{
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
Debugger.Break();
request.Issue.IsNew = false;
adapter.SaveEntity(request.Issue);
adapter.FetchEntity(request.Issue);
}
return request.Issue.Title.Trim();
}
As soon as execution enters this block, the IsNew property flips to "True" but the other properties retain their assigned values! Since IsNew is now True, the SaveEntity() call inserts a record instead of updates! But if I reset the Isnew to false as shown above, it correctly updates! really strange.....
And yes, since this is an "Update" method, i could always just set IsNew property just before calling SaveEntity(), but shouldn't have to I don't think.. why should that one property flip?
Any ideas?
Harold