EntityCollection question

Posts   
 
    
exp2000
User
Posts: 68
Joined: 13-Apr-2006
# Posted on: 07-Sep-2006 23:09:33   

Does adapter.SaveEntityCollection work only on fetched entities or can it be applied to newly created entity collection ?


                Dim sharedRoleQueries As New EntityCollection(New SharedRoleQueryEntityFactory)
                For idx As Integer = 0 To shareWithRoleIds.Count - 1
                    sharedRoleQueries.Add(SharedRoleQueryManager.Create(fromUserId, queryId, CType(shareWithRoleIds(idx), Integer), Now))
                Next

               SharedRoleQueryManager.SaveCollection(sharedRoleQuery)


SaveCollection just calls adapter's SaveEntityCollection method, but nothing happens. Since help talks only about working with collections after fetching it I wonder if need to loop through each entity in collection and save it?

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 07-Sep-2006 23:49:32   

SaveEntityCollection definitely works on new objects.

Add the following to your app.config to see the SQL being generated.


<system.diagnostics>
    <switches>
        <add name="SqlServerDQE" value="3" />
    </switches>
</system.diagnostics>


Search for SqlServerDQE to see switches for other databases.

exp2000
User
Posts: 68
Joined: 13-Apr-2006
# Posted on: 08-Sep-2006 00:04:54   

Thanks for a response, problem was somewhere else, there was nothing in collection to begin with.