Hi there,
I have a problem which sometimes occurs when my application restarts during the day, while users are online. I'm currently using the 2007.0913 Release version of ES, SQL Server 2005, although this is not a new issue related to this release of ES, I've seen it now and again for the last year or so. It's very infrequent but worth reporting all the same.
What happens is, just after the application restarts I sometimes get an error message from the application 'Object reference not set to an instance of an object'. The stack trace indicates that the error occurs while trying to populate data into one of my ES objects.
A cutdown version of the stack trace looks something like this,
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at BusinessObjects.CompaniesMetadata.esDefault(String mapName) in ...\Generated\Companies.vb
at BusinessObjects.CompaniesMetadata.GetProviderMetadata(String mapName) in ...\Generated\Companies.vb
at EntitySpaces.Interfaces.esDynamicQuery.PopulateRequest(esDataRequest request)
at EntitySpaces.Interfaces.esDynamicQuery.Load()
I've indicated the line in esDefault below where the error occurs,
Code:
Private Function esDefault(ByVal mapName As String) As esProviderSpecificMetadata
If (Not _providerMetadataMaps.ContainsKey(mapName)) Then
Dim meta As esProviderSpecificMetadata = New esProviderSpecificMetadata()
meta.AddTypeMap("ID", new esTypeMap("int", "System.Int32"))
.
.
.
meta.Source = ...
meta.Destination = ...
meta.spInsert = ...
meta.spUpdate = ...
meta.spDelete = ...
meta.spLoadAll = ...
meta.spLoadByPrimaryKey = ...
Me._providerMetadataMaps.Add("esDefault", meta) '<--- Error Here
End If
Return Me._providerMetadataMaps("esDefault")
End Function
I'm wondering, especially since this problem only happens rarely, whether this is related to two users querying the database around the same time, just after the restart?? And for both of them, it initially looks like the esDefault metadata map is not setup yet for a specific table, so they both try to add it around the same time? That's just a complete guess though.
My ES classes have been regenerated using the 2007.0913 templates, and in MyGeneration the Generated Master Classes template advanced options, the only checkboxes I have ticked are Generate a Single File, Metadata Class Should Ignore Schema and Metadata Class Should ignore Catalog.
Not sure what further info you might need so I'll hand over to you. Hoping you can help. Thanks.