yasser777 / nettiers

Automatically exported from code.google.com/p/nettiers
0 stars 0 forks source link

MarkForDelete() on all children, followed by the parents and executed with DeepSave() #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I'm using Nettiers 2.2 and very happy with it. Lately we tracked down a
problem that occurred when we did a MarkForDelete() on all children,
followed by the parents and executed with DeepSave(). We run into a problem
in that it generated an exception that turned out to be a foreign key
contraint violation that only happened if the TList contained more than 300
entities. When searching through the code, I discovered the following in
one of the templates (EntityProviderCoreClass.generated.cst):

        /// Adds the specified entity property to the collection of properties.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="key"></param>
        public void AddRun( Object entity, string key )
        {
            if (entity != null && !string.IsNullOrEmpty(key))
            {
                string lkey;
                if (entity is IEntity)
                    lkey = ((IEntity)entity).EntityTrackingKey + key;
                else
                    lkey = entity.GetHashCode().ToString()+ key;

                DeepSessionInnerList.Add(lkey, entity);
            }

            if (DeepSessionInnerList.Count > 300)
                CancelSession = true;
        }

Can anyone shed any light as to why the number 300 is hard coded into the
template and preventing a DeepSave() of more than 300 child entities?
Intentional or a bug?

Post (http://community.codesmithtools.com/forums/p/8322/30612.aspx#30612)

What version of .netTiers and CodeSmith are you using?

Nettiers 2.2

Please use labels and text to provide additional information.

Original issue reported on code.google.com by bniemyjski on 23 May 2008 at 12:12

GoogleCodeExporter commented 9 years ago
So why isn't this some sort of generated constant?

Original comment by beriniw...@hotmail.com on 31 May 2008 at 8:28

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 30 Nov 2008 at 1:22

GoogleCodeExporter commented 9 years ago
This is a problem inherint with the way they do deepsaves.  This is a nightmare 
to 
track down and fix.

In all these cases, I always say if Deep Save does not work for you, don't use 
it.  
Write your own save.  I think as part of the next version, we look at making 
the 
check for this at Generation time, not run time.

These constraints are put in there in order to keep from doing endless loops in 
deep 
load and deep save.

I say we mark this one as next version.

Original comment by jmhin...@gmail.com on 9 Dec 2008 at 3:32

GoogleCodeExporter commented 9 years ago

Original comment by debajit....@gmail.com on 11 Dec 2008 at 12:01

GoogleCodeExporter commented 9 years ago

Original comment by jmhin...@gmail.com on 29 Dec 2008 at 4:00

GoogleCodeExporter commented 9 years ago

Original comment by jmhin...@gmail.com on 3 Feb 2009 at 5:03

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 May 2009 at 3:16

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 May 2009 at 3:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here is my attempt at solving this problem.
Patch against r803

Original comment by CableGuy...@gmail.com on 1 Nov 2009 at 5:41

Attachments:

GoogleCodeExporter commented 9 years ago
I have started on this.  Will try and get committed fairly quickly.  Thanks for 
the 
contribution!

On a side note, I might want to discuss this one with you.  I am going to take 
a 
look and see what you did might want to discuss with you.  keep an eye out for 
emails.

Original comment by jmhin...@gmail.com on 3 Nov 2009 at 1:50