Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> LLBLGen Pro 2.6 Self-Servicing GetMulti Returning Dirty Objects
 

Pages: 1
LLBLGen Pro Runtime Framework
LLBLGen Pro 2.6 Self-Servicing GetMulti Returning Dirty Objects
Page:1/1 

  Print all messages in this thread  
Poster Message
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 12-Aug-2009 23:01:51.  
Hello Everyone,

I'm having an issue with "Dirty" objects being returned.

It is happening with the following Apple:

            Debug.WriteLine("Before Apple DTO Fetch.")
            Debug.WriteLine(String.Format("Before Fetch ApplesIsDirty: {0}", Fruit.Apples.ContainsDirtyContents))

            Fruits.Apples.GetMulti(CodeFields.ListId = System.DBNull.Value Or AppleFields.FruitId = Fruit.FruitId, _
                                0, _
                                New SortExpression(New SortClause(AppleFields.FruitId, SortOperator.Ascending)))

            Debug.WriteLine(String.Format("After Fetch Codes IsDirty: {0}", Fruit.Apples.ContainsDirtyContents))
            Debug.WriteLine("After Apples DTO Fetch.")

The objects being returned by this query are automatically marked as IsDirty.

Is this a bug in the framework, or could something else be causing this issue?


Thanks! Confused
  Top
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 12-Aug-2009 23:15:04.  
Seems like GetMulti is definately returning IsDiryty Objects?



Before Apple DTO Fetch.
Before Fetch Apples IsDirty: False

Method Enter: EntityBase.CheckForRefetch
Method Exit: EntityBase.CheckForRefetch: state is not OutOfSync
Method Enter: CollectionCore.Clear
Method Exit: CollectionCore.Clear
Method Enter: DaoBase.PerformGetMultiAction
Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query:
    Query: SELECT [MyComponent].[dbo].[Apples].[AppleID] AS [AppleId], [MyComponent].[dbo].[Apples].[Apple], [MyComponent].[dbo].[Apples].[FruitID] AS [FruitId], [MyComponent].[dbo].[Apples].[Description], [MyComponent].[dbo].[Apples].[Type], [MyComponent].[dbo].[Apples].[Query], [MyComponent].[dbo].[Apples].[IsDeleted] FROM [MyComponent].[dbo].[Apples] WHERE ( ( [MyComponent].[dbo].[Apples].[FruitID] IS NULL OR [MyComponent].[dbo].[Apples].[FruitID] = @FruitId1)) ORDER BY [MyComponent].[dbo].[Apples].[FruitID] ASC
    Parameter: @FruitId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b.

Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.
Method Enter: DaoBase.ExecuteMultiRowRetrievalQuery
Executed Sql Query:
    Query: SELECT [MyComponent].[dbo].[Apples].[AppleID] AS [AppleId], [MyComponent].[dbo].[Apples].[Apple], [MyComponent].[dbo].[Apples].[FruitID] AS [FruitId], [MyComponent].[dbo].[Apples].[Description], [MyComponent].[dbo].[Apples].[Type], [MyComponent].[dbo].[Apples].[Query], [MyComponent].[dbo].[Apples].[IsDeleted] FROM [MyComponent].[dbo].[Apples] WHERE ( ( [MyComponent].[dbo].[Apples].[FruitID] IS NULL OR [MyComponent].[dbo].[Apples].[FruitID] = @FruitId1)) ORDER BY [MyComponent].[dbo].[Apples].[FruitID] ASC
    Parameter: @FruitId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b.

Method Enter: CollectionCore.PerformAdd
Entity to Add Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: e00223de-4af8-4144-99c3-1a6bd8a9174e
    PrimaryKey field: AppleId. Type: System.Guid. Value: af106743-2060-4a2a-99ce-6bc2887c8195
Method Enter: EntityBase.SyncFKFields
Active Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: e00223de-4af8-4144-99c3-1a6bd8a9174e
    PrimaryKey field: AppleId. Type: System.Guid. Value: af106743-2060-4a2a-99ce-6bc2887c8195
Data Supplying Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.FruitEntity. ObjectID: e00223de-4af8-4144-99c3-1a6bd8a9174e
    PrimaryKey field: FruitId. Type: System.Guid. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b
:     Syncing FK field FruitId with PK field FruitId
Method Exit: EntityBase.SyncFKFields
Index of added entity: 0
Method Exit: CollectionCore.PerformAdd
Method Enter: CollectionCore.PerformAdd
Entity to Add Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: 646c1a11-d930-4558-b402-1e44b0e44547
    PrimaryKey field: AppleId. Type: System.Guid. Value: 8d888556-d84e-4c7e-910b-d5a23e552de4
Method Enter: EntityBase.SyncFKFields
Active Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: 646c1a11-d930-4558-b402-1e44b0e44547
    PrimaryKey field: AppleId. Type: System.Guid. Value: 8d888556-d84e-4c7e-910b-d5a23e552de4
Data Supplying Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.FruitEntity. ObjectID: 646c1a11-d930-4558-b402-1e44b0e44547
    PrimaryKey field: FruitId. Type: System.Guid. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b
:     Syncing FK field FruitId with PK field FruitId
Method Exit: EntityBase.SyncFKFields
Index of added entity: 1
Method Exit: CollectionCore.PerformAdd
Method Enter: CollectionCore.PerformAdd
Entity to Add Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: 1961aff4-4823-420b-9952-d85e5b73a1e9
    PrimaryKey field: AppleId. Type: System.Guid. Value: 3c803283-0bc4-4194-8922-c92c75d58bb6
Method Enter: EntityBase.SyncFKFields
Active Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: 1961aff4-4823-420b-9952-d85e5b73a1e9
    PrimaryKey field: AppleId. Type: System.Guid. Value: 3c803283-0bc4-4194-8922-c92c75d58bb6
Data Supplying Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.FruitEntity. ObjectID: 1961aff4-4823-420b-9952-d85e5b73a1e9
    PrimaryKey field: FruitId. Type: System.Guid. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b
Method Exit: EntityBase.SyncFKFields
Index of added entity: 2
Method Exit: CollectionCore.PerformAdd
Method Enter: CollectionCore.PerformAdd
Entity to Add Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: 1acc5781-8ed1-4ff3-b2ae-35b5c249bfce
    PrimaryKey field: AppleId. Type: System.Guid. Value: ffba4f42-c8e6-4cad-974c-4200095fa371
Method Enter: EntityBase.SyncFKFields
Active Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: 1acc5781-8ed1-4ff3-b2ae-35b5c249bfce
    PrimaryKey field: AppleId. Type: System.Guid. Value: ffba4f42-c8e6-4cad-974c-4200095fa371
Data Supplying Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.FruitEntity. ObjectID: 1acc5781-8ed1-4ff3-b2ae-35b5c249bfce
    PrimaryKey field: FruitId. Type: System.Guid. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b
Method Exit: EntityBase.SyncFKFields
Index of added entity: 3
Method Exit: CollectionCore.PerformAdd
Method Enter: CollectionCore.PerformAdd
Entity to Add Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: df3f24f6-b1ea-4bc4-92ad-74e0d64a7cf6
    PrimaryKey field: AppleId. Type: System.Guid. Value: e2e58ed0-530c-4231-bce3-9c2515301d36
Method Enter: EntityBase.SyncFKFields
Active Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.AppleEntity. ObjectID: df3f24f6-b1ea-4bc4-92ad-74e0d64a7cf6
    PrimaryKey field: AppleId. Type: System.Guid. Value: e2e58ed0-530c-4231-bce3-9c2515301d36
Data Supplying Entity Description:
    Entity: MyCompany.MyProduct.MyComponent.DAL.EntityClasses.FruitEntity. ObjectID: df3f24f6-b1ea-4bc4-92ad-74e0d64a7cf6
    PrimaryKey field: FruitId. Type: System.Guid. Value: fa96d051-49c3-4df4-aeb3-dd581dae732b
Method Exit: EntityBase.SyncFKFields
Index of added entity: 4
Method Exit: CollectionCore.PerformAdd
Method Exit: DaoBase.ExecuteMultiRowRetrievalQuery
Method Exit: DaoBase.PerformGetMultiAction
After Fetch Apples IsDirty: True
After Apple DTO Fetch.


  Top
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 12-Aug-2009 23:39:53.  
Here's something strange, I created a new instance of a collection object:

            Dim Apples As New AppleCollection

            _Apples.GetMulti(AppleFields.FruitId= System.DBNull.Value Or AppleFields.FruitId= List.ListId, _
                                0, _
                                New SortExpression(New SortClause(AppleFields.FruitId, SortOperator.Ascending)))


This works correctly... So it seems when I use Fruit.Apples.GetMulti, this returns an invalid collection with IsDirty = True...

Any ideas?
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 13-Aug-2009 09:57:26.  
Quote:
            Fruits.Apples.GetMulti(CodeFields.ListId = System.DBNull.Value Or AppleFields.FruitId = Fruit.FruitId, _
                                0, _
                                New SortExpression(New SortClause(AppleFields.FruitId, SortOperator.Ascending)))

CodeFields.ListId, is this a Typo or you forgot to add the relation to this entity?

Why are you sorting on AppleFields.FruitId, as it seems to me all fetched Apples will have the same FruitId?

Which LLBLGen Pro runtime library version are you using?

Please try the following code:
Code:
AppleCollection apples = Fruits.GetMultiApples(/*put your filter here*/);

No need to add the FruitId filter.


  Top
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 13-Aug-2009 16:59:12.  
Walaa wrote:
Quote:
            Fruits.Apples.GetMulti(CodeFields.ListId = System.DBNull.Value Or AppleFields.FruitId = Fruit.FruitId, _
                                0, _
                                New SortExpression(New SortClause(AppleFields.FruitId, SortOperator.Ascending)))

CodeFields.ListId, is this a Typo or you forgot to add the relation to this entity?

Why are you sorting on AppleFields.FruitId, as it seems to me all fetched Apples will have the same FruitId?

Which LLBLGen Pro runtime library version are you using?

Please try the following code:
Code:
AppleCollection apples = Fruits.GetMultiApples(/*put your filter here*/);

No need to add the FruitId filter.




I was using the May runtime, but this is also happening with the August 11th runtime (2.6.9.807), .NET 3.5, v2.6, Self-Servicing.

Sorry, CodeFields.ListID should be AppleFields.Fruit ID, I forgot to full obfuscate the code Tongue



Couple more notes:

1. The issue with the Dirty flag only occurs when I use Fruit.Apples.GetMulti

2. This does not occur when I do:

Dim Collection as new AppleCollection

Collection.GetMulti(CodeFields.ListId = System.DBNull.Value Or AppleFields.FruitId = Fruit.FruitId)




The reason why I added the FruitID filter is so I can use an OR clause instead of an AND clause.





  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 14-Aug-2009 07:13:46.  
Quote:
Fruits.Apples.GetMulti(AppleFields.FruitId = System.DBNull.Value Or AppleFields.FruitId = Fruit.FruitId, 0, New SortExpression(New SortClause(AppleFields.FruitId, SortOperator.Ascending)))


Having a second look at the above code, I realized it must return some dirty objects.
As GetMulti() will fetch all apples according to the passed filter, accordingly some apples with FruitId == null will be fetched. Adding these to the Fruit.Apples collection wil automatically set their FruitId to the Fruit.Id and thus making them dirty.

I think removing the (AppleFields.FruitId = System.DBNull.Value) predicate will make sure all fetched objects are indeeed related to the Fruit in hand and thus no FK will be set when these entities are added to the Fruit.Apples collection.


  Top
Pages: 1  


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

Version: 2.1.12172008 Final.