Hi, VB, LLBLGen 2.0, Adapter, SQL Server 2K
I have 2 questions related to collections maintained within grids. These collections are saved via appropriate Manager Classes eg:
Sub SaveAllRegion(ByVal allRows As EntityCollection(Of RegionEntity))
Dim adapter As New DataAccessAdapter()
Try
adapter.SaveEntityCollection(allRows, True, False)
Finally
adapter.Dispose()
End Try
End Sub
- First I'm puzzelled that I have to explicitly do a refetch (_adapter.FetchEntityCollection(allRegion, Nothing_) in order that I can see the auto-incremented PK of a newly added row.
What am I missing?
- When column 1 (the PK) is not an Identity field and validation prevents the entry of duplicate PKs being entered, what strategy or strategies are developers using to cope with the possibility of duplicate PKs when saving the collection to the db.
i.e. When I save my collection what should I be doing to respond to an error if a duplicate PK is encountered during adapter.SaveEntityCollection(allRows, True, False)?
Hope that makes sense
Thanks