DataProjection to m:n Collection Giving ReadOnly Error

Posts   
 
    
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 22-Jan-2007 21:53:07   

Hi Frans,

Long time no speak!!! Hope you are well...

I ran into an issue this evening while trying to refactor a prefetch path to a data projection. I was previously using a prefetch path to fetch a m:n collection "FolderCollection". Using the projector, I am getting a "This collection is read-only." error...


projector = new DataProjectorToIEntityCollection2(itemEntity.FolderCollection);
adapter.FetchProjection(_folderValueProjectorList, projector, reader);

Is this something you've run into before / any recommended strategy?

Marcus

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 23-Jan-2007 08:50:43   

A similar problem was reported before (and fixed): http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6712

If you a later version (than the one mentioned to be fixed), please post the runtimeLibrary version.

Please post a complete code snippet too. Also a compete error/exception text with stack trace.

THanks.

Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 23-Jan-2007 09:36:15   

Walaa wrote:

A similar problem was reported before (and fixed): http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6712

If you a later version (than the one mentioned to be fixed), please post the runtimeLibrary version.

DataProjections were only introcuded in 2.0 and I think the fix above is for v 2005.1

I am running 2.0.0.0 Final Aug 3rd.

Walaa wrote:

Please post a complete code snippet too. Also a compete error/exception text with stack trace.


[3336] Message: This collection is read-only. 
[3336] TargetSite: Int32 PerformAdd(T) 
[3336] StackTrace:  at SD.LLBLGen.Pro.ORMSupportClasses.CollectionCore`1.PerformAdd(T item) 
[3336]  at SD.LLBLGen.Pro.ORMSupportClasses.CollectionCore`1.Add(T item) 
[3336]  at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1.SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollection2.Add(IEntity2 entityToAdd) 
[3336]  at SD.LLBLGen.Pro.ORMSupportClasses.DataProjectorToIEntityCollection2.AddProjectionResultToContainer(IList projectors, Object[] rawProjectionResult) 
[3336]  at SD.LLBLGen.Pro.ORMSupportClasses.ProjectionUtils.FetchProjectionFromReader(List`1 valueProjectors, IGeneralDataProjector projector, IDataReader datasource, Int32 maxNumberOfItemsToReturn, Int32 pageNumber, Int32 pageSize, Boolean clientSideLimitation, Boolean clientSideDistinctFiltering, Boolean clientSidePaging) 
[3336]  at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchProjection(List`1 valueProjectors, IGeneralDataProjector projector, IDataReader reader) 
[3336]  at Sds.ModernArk.Services.Ark.DataManagers.ItemSummaryReader.GetItemWithAdditionalInfo(Int64 itemID, Boolean includeTags, Boolean includeFolders, Boolean includeComments, Boolean includeClipboardInfo, Boolean inlcudePermissions, ReaderTools tools) in C:\Source\Sds.ModernArk.Services.Ark\DataReaders\ItemSummaryReader.cs:line 408 
[3336]  at Sds.ModernArk.Services.Ark.DataManagers.ItemManager.GetItemWithAdditionalInfo(Int64 itemID, String renditionSize, Boolean includeTags, Boolean includeFolders, Boolean includeComments, Boolean inlcudePermissions, Boolean includeLicenses, Boolean inlcudeClipboardInfo, ReaderTools tools) in C:\Source\Sds.ModernArk.Services.Ark\DataManagers\ItemManager.cs:line 251 

The question is firstly... is projecting data into an entitiy's ReadOnly m:n collection supported?

Marcus

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Jan-2007 10:13:03   

Hi Marcus, I hope you're well too! smile

I've to check it out, I can't find anything in the changelog nor bugtracker so I don't think it's handled at the moment, however it should be.

A possible workaround could be to first set the readonly flag for the collection to false, then perform the projection. Not ideal, but doable, as the projections currently can't follow hierarchies anyway.

Frans Bouma | Lead developer LLBLGen Pro
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 23-Jan-2007 10:59:13   

Otis wrote:

I've to check it out, I can't find anything in the changelog nor bugtracker so I don't think it's handled at the moment, however it should be.

A possible workaround could be to first set the readonly flag for the collection to false, then perform the projection. Not ideal, but doable, as the projections currently can't follow hierarchies anyway.

Yes I had already implemented the workaround as a quick fix... Thanks!