Hi,

I'm trying to implement the Reprocessing library. I've installed the Reprocessing using NuGet and am now trying to create my first Reprocessing.

Here's the code I've written so far and my findings below:

    [Secure]
    public object GetOpdrachtRegelList (string data)
    {
        try
        {
            int count = 0;

            return Xtensive.Orm.Session.Current.Domain.WithStrategy(ExecuteActionStrategy.HandleReprocessableException)
                .Execute<object>(session =>
                {
                    DataSourceParameters dsp = JsonConvert.DeserializeObject<DataSourceParameters>(data, JsonSettings);

                    using (VMOpdrachtEntity entity = VMOpdrachtEntity.GetById(this, dsp.parentId))
                    {
                        entity.LoadOpdrachtRegelList(out count, dsp);

                        Dictionary<string, object> aggregates = null;

                        if (dsp.aggregate != null && dsp.aggregate.Count > 0)
                        {
                            aggregates = entity.GetAggregatesForOpdrachtRegelList(dsp);
                        }

                        DataResponse response = new DataResponse()
                        {
                            Data = entity.OpdrachtRegelList.ToArray(),
                            Size = count,
                            Aggregates = aggregates
                        };

                        return GetJsonp((object)response);
                    }
                });
        }
        catch(Exception ex)
        {
            return HandleExceptions(ex);
        }
    }

The reprocessing does not take place when a DeadlockException is thrown by MSSQL. What happens in my opinion is that a TargetInvocationException is throw in the code somewhere which has a DeadlockException inner exception. The reprocessing module (after decompiling the dll and analyzing the code) does not test for that kind of Exceptions. I believe that is why it does not reprocess the action.

Regards Paul

asked May 20 '14 at 08:20

Paul%20Sinnema's gravatar image

Paul Sinnema
261878896

edited May 20 '14 at 08:21


2 Answers:

Ok, The error is thrown during serialization of the result to JSON. I've added some extra code for testing and now it does reprocess.

                    catch (Exception ex)
                    {
                        if(ex is Xtensive.Orm.ReprocessableException)
                        {
                            throw ex;
                        }

                        if (ex.InnerException is Xtensive.Orm.ReprocessableException)
                        {
                            throw ex.InnerException;
                        }

                        throw;
                    }

answered May 20 '14 at 08:42

Paul%20Sinnema's gravatar image

Paul Sinnema
261878896

Hello, Paul. I think this is because your entity(ies) contains references or/and "aggregates" contains Linq Expressions (sql command(s) executing while it's enumerating). In first case you can prefetch these references, in second case you can call ToArray or ToList to force sql command(s) execution. Or you can just unwrap exeption, or prohibit GetJsonp wrapping Exception (if it supports this)

answered May 26 '14 at 05:35

proff's gravatar image

proff
75336

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×2

Asked: May 20 '14 at 08:20

Seen: 2,115 times

Last updated: May 26 '14 at 05:35

powered by OSQA