LLBLGen Pro v. 1.0.2005.1
Hi guys,
I have a problem, I hope somebody can help.
I have a simple entity object:
ProductEntity
ProductId - PK
ProductDescription
ProductId is PK but it is not an identity. So I have a form that fills out the info for the ProductEntity. Since PK is not an identity, there may be cases when the user enters a PK that already exists, in which case we get some PRIMARY KEY violation exception. The strange thing is that when this happens, no matter what value I change the ProductId to afterwards (upon pressing BACK on the web brower OR re-entering the webform), and then save, I ALWAYS get that same PRIMARY KEY violation exception. I am creating that ProductEntity the moment before I save it, so there should not be any residual state on that Entity. In fact, I put a break point right up to the point before calling Save(), and the ProductId value is indeed correct (ie. it is one that does not exist), but then when I Save, i still get that exception. I checked the ORMException whatever exception, and find that even though the ProductId for the Entity is the new value, the generated SQL Statement has the ORIGINAL ProductId i first entered that generated the PRIMARY KEY violation. I don't know how is this possible, as I said, I create a NEW ProductEntity and populate the values upon the user pressing Save. Any help?