Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SaveEntity() does not save
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01331050
Message ID:
01331345
Views:
14
I do not believe that GetEntity returns a NewEntity when no results are found. I confirmed this by running the following:
public int TestGetStatusByDesc(string statusDesc)
        {
            Status oStatus = new Status();
            StatusEntity SE = oStatus.GetStatusByDesc(statusDesc);
            if (!SE.HasValues)
            {
                //oStatus.NewEntity();
                oStatus.Entity.StatusDesc = statusDesc;
                oStatus.Entity.StatusDescExplanation = statusDesc;
                oStatus.SaveEntity();
            }
            return oStatus.Entity.StatusID;
When I ran (via my testbench) the above (with the NewEntity() line commented) for a value that did not exist in the status table, nothing was added or saved. When I ran the code after removing the comment so NewEntity would run, the row was added and successfully saved.

Since you say that you tried running NewEntity() without success, be sure that you check your return values and see what's going on when you run your methods.

Also, is it possible that your test condition (checking for null) is not returning true?



>GetEntity returns a new entity even if there are no results, but all properties (fields) are null, so there is no need for NewEntity(), but I even tryed that, and it's still not saving data.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform