Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> FindMatches returns wrong number of matches
 

Pages: 1
Bugs & Issues
FindMatches returns wrong number of matches
Page:1/1 

  Print all messages in this thread  
Poster Message
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 04-Jun-2009 08:29:33.  
Hi,

I'm using LLBLGenPro runtime of 12th May and I have a strange issue.

I use FindMatches on an EntityCollection and the result is wrong. I attached a screenshot of my watch window. I have an entitycollection with 3 elements. I used following statement:

Code:

indices = TimeSliceGroups.FindMatches(MemoryEm3200TimeSliceGroupFields.TimeSliceGroupBits == pData.TimeSliceGroupBits & MemoryEm3200TimeSliceGroupFields.Deleted == 0 & MemoryEm3200TimeSliceGroupFields.ExternalIdlink == 0);


This result in indices.Count == 0. Although when I change the filter into (I removed the MemoryEm3200TimeSliceGroupFields.Deleted == 0 part)

Code:

indices = TimeSliceGroups.FindMatches(MemoryEm3200TimeSliceGroupFields.TimeSliceGroupBits == pData.TimeSliceGroupBits & MemoryEm3200TimeSliceGroupFields.ExternalIdlink == 0)


I get a count of 1. It says me that the element with index 2 is a match. When I then ask the Deleted value of the element of position 2 I get that the value is 0. So it should also be found by the first predicate.

Btw, it's a boolean field and I already tried the filter with the false value. Same result.

I don't have any problems with FindMatches before so I probably did something wrong. Does any of you have any idea?

Kind regards,
TomV
Life goes fast, it must be riding a Ducati!  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 04-Jun-2009 09:17:30.  
Would you please try the following code:
Code:
IPredcate filter = new PredicateExpression();
filter.Add(MemoryEm3200TimeSliceGroupFields.TimeSliceGroupBits == pData.TimeSliceGroupBits);
filter.Add(MemoryEm3200TimeSliceGroupFields.Deleted == false);
filter.Add(MemoryEm3200TimeSliceGroupFields.ExternalIdlink == 0);

indices = TimeSliceGroups.FindMatches(filter);


  Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 04-Jun-2009 09:40:29.  
Hi Walaa,

I tried following code:

Code:

IPredicate filter = new PredicateExpression();
            
filter.Add(MemoryEm3200TimeSliceGroupFields.TimeSliceGroupBits == pData.TimeSliceGroupBits);
filter.Add(MemoryEm3200TimeSliceGroupFields.Deleted == false);
filter.Add(MemoryEm3200TimeSliceGroupFields.ExternalIdlink == 0);

indices = TimeSliceGroups.FindMatches(filter);


but I receive following error:

Error    230    'SD.LLBLGen.Pro.ORMSupportClasses.IPredicate' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'SD.LLBLGen.Pro.ORMSupportClasses.IPredicate' could be found (are you missing a using directive or an assembly reference?)
Life goes fast, it must be riding a Ducati!  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 04-Jun-2009 09:48:17.  
Sorry, try this instead:
Code:
IPredicateExpression filter = new PredicateExpression();


  Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 04-Jun-2009 10:02:00.  
Hi Walaa,

I'm afraid it has the same result.
I also created a filter2 via my immediate window (without the deleted == false statement) and the count is 1.

So both ways react identically.

I attached another screenshot of what I did.

Can this be linked to my code in some way? I never had problems before with predicate(expressions).

Regards,
TomV
Life goes fast, it must be riding a Ducati!  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8099 posts
# Posted on: 05-Jun-2009 04:54:31.  
- Is there something special about the Deleted field? or Something special about the entity (inheritance, etc...)?
- What LLBLGen Runtime Library version are you using? (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7717)


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 05-Jun-2009 07:26:29.  
HI Daelmo,

It's the latest runtime available, the one of 12th of May 2009 file version of SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll is 2.6.9.511.
It's indeed an entity that is a child of a base entity which works with a discriminator. The deleted field is a normal boolean field, nothing special about that.

Regards,
TomV
Life goes fast, it must be riding a Ducati!  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 05-Jun-2009 08:54:04.  
Would you please cook a small and simple repro solution for us and attach it here?

Thanks.


  Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 05-Jun-2009 09:01:23.  
Hi Walaa,

Sure I'm willing to do so, but as I stated before I never had any problems with the predicate expressions before, or at least not that I noticed so far. So when I create a repro solution it will probably work.

And also, just like everybody else in here our application is very complex Cool

Can I do anything else to give you guys more information. It's not a big thing if I have to change my BL like I did yesterday.

Kind regards,
TomV
Life goes fast, it must be riding a Ducati!  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 05-Jun-2009 09:12:45.  
I believe you, that's the same thing over here, we won't be able to reproduce it.
But maybe if you can extract this entity and collection into a new project and send it over.
Don't start a repro from scratch, just copy the lgp project file into another place, open it and remove all un-needed entities, and just leave the relevant ones.
Generate the code, and then create a new console application or a test dll project.
And try to repro the same behaviour, calling FindMatches(), and then send this solution over.

For Privacy: you can either open a Helpdesk thread and attach the solution there, or mail it to: support AT llblgen DOT com, and mention this thread in your mail.


  Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 05-Jun-2009 09:15:02.  
Hi Walaa,

I started a new console app and you can see the result in attachment.
Maybe you can already see in that code if I do something wrong or make a insane assumption :-)

If not I will do what you asked. Or would you have enough with this solution?

Update: Please notice that there was a copy - paste error in my previous screenshot!
I always used ts1 to set the values, so off course there was only 1 match. I'm now creating the stripped down lgp and console app as you requested...

Kind regards,
TomV

Life goes fast, it must be riding a Ducati!  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 05-Jun-2009 10:22:36.  
Hang on.

I was able to reproduce it.

I was mistaken, I couldn't reproduce it using the following Northwind code:

Code:
            ProductsCollection products = new ProductsCollection();
            ProductsEntity product1 = new ProductsEntity();
            product1.ProductName = "PR1";
            product1.UnitPrice = 10;
            product1.Discontinued = true;
            products.Add(product1);

            ProductsEntity product2 = new ProductsEntity();
            product2.ProductName = "PR2";
            product2.UnitPrice = 20;
            product2.Discontinued = false;
            products.Add(product2);

            ProductsEntity product3 = new ProductsEntity();
            product3.ProductName = "PR3";
            product3.UnitPrice = 30;
            product3.Discontinued = true;
            products.Add(product3);

            List<int> indices = products.FindMatches((ProductsFields.UnitPrice > 10) & (ProductsFields.Discontinued == false));


Which always return the correct count based on the data specified.
I tried increasing the entities and the count of false fields, and FindMatches always gave me the correct count.


  Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 05-Jun-2009 10:37:58.  
Hi Walaa,

I created a repro console app and was able to simulate. I will create a HelpDesk thread and post it for privacy reasons.

Kind regards,
TomV
Life goes fast, it must be riding a Ducati!  Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 05-Jun-2009 10:47:46.  
Hi Walaa,

Thread created in helpdesk forum with guidelines how to simulate, and project uploaded.

Kind regards,
TomV


Life goes fast, it must be riding a Ducati!  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37812 posts
# Posted on: 05-Jun-2009 12:27:52.  
Continued in helpdesk thread.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.