Otis wrote:
mikeg22 wrote:
You really need to do a bunch of things to the entity to make everything work right. After a save, we do the following:
1. Set DBValue to the correct value for every field
2. Set the IsNull for everyfield that got set to Null
3. Set Fields.State = EntityState.Fetched
4. Call Fields.AcceptChanges
5. Set IsNew = False
6. Set IsDirty = False
7. (Probably optional) Call FlagAsSaved
It would be nice if we could just tell LLBLGEN that we don't use DB triggers, and anything saved to the database is just a simple update...so you could just call SaveEntity and the 7 steps above would just happen.
What you want is only valid after a fetch or better: it's done for you if you set the refetch flag to true. I don't see why that's so much of a problem, as the fetch is very quick: over the same connection, and the same row.
Its a problem for a couple reasons. First, our fetches are not fast as they go through a stored procedure which performs security filtering, and second, because when we send an object to our server via remoting for an update/insert, we don't remote it back (again for performance). In our particular case, we have to run those 7 steps both in the DAL on update, and on the client side when the remoting call finishes.
We are having a serious discussion right now whether or not to stop using these fetch stored procedures as they are causing nightmare performance problems, as well as severely limiting filtering capability. I personally want to implement our custom security with relations and predicates, but the powers that be like to see an easy to read SQL Profilter line for every DB fetch...not worth the trouble in my opinion, and hopefully the others will see it this way