Example #1
0
        public void Postprocess(DbDataReader reader, IList <Exception> exceptions)
        {
            var success = false;

            if (reader.Read())
            {
                var version = reader.GetFieldValue <Guid>(0);
                success = version == _newVersion;
            }
            ;

            if (success)
            {
                _versions.Store <T>(_id, _newVersion);
            }
            else
            {
                exceptions.Add(new ConcurrencyException(typeof(T), _id));
            }
        }
        private void checkAndStoreVersions(IList <Exception> exceptions, bool success)
        {
            if (_mode == ConcurrencyChecks.Enabled)
            {
                if (success)
                {
                    _setVersion(_newVersion);
                    _versions.Store <T>(_id, _newVersion);
                }
                else
                {
                    _setVersion(_oldVersion ?? Guid.Empty);

                    exceptions.Add(new ConcurrencyException(typeof(T), _id));
                }
            }
            else
            {
                _setVersion(_newVersion);
            }
        }