Howdy All,
I am trying to use an Entity of a Oracle table that I can NOT modify. It, unfortunately has a Composite Key of three nvarchar2 (32, 160, 32 size) fields. And When I try to add that table to a datagridview as a datasource I get and error in the "GetHashCode" function:
System.OverflowException was unhandled
Message=Arithmetic operation resulted in an overflow.
Source=EditorMaintenance
StackTrace:
at EditorMaintenance.EditorMaintenance.LayerId.GetHashCode() in C:\Projects\Utilities\EditorMaintenance\EditorMaintenance\CCatData.vb:line 709
at Mindscape.LightSpeed.Model.UniqueId.GetHashCode()
at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at Mindscape.LightSpeed.IdentityMap.RegisterEntity(Entity , UnitOfWorkBase )
at Mindscape.LightSpeed.Mapping.EntityLoader.LoadEntityFromReader(AliasedTypeModel , Object , Boolean )
at ..(AliasedTypeModel , QueryExpression , Order , Group , String , Boolean , Boolean )
at ..(LightSpeedContext , List`1 , QueryExpression , Order , Group , String , Boolean , Boolean )
at ..(AliasedTypeModel , IList , String , Boolean )
at ..(TypeModel , Query , IList )
at ..(UnitOfWorkBase , TypeModel , Query , IList )
at ..(Query , TypeModel , IList )
at ..(Query , IList )
at Mindscape.LightSpeed.UnitOfWork.Find(Query query, IList results)
at Mindscape.LightSpeed.UnitOfWorkBase.Find(Query query)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ExecuteImmediate(IUnitOfWork unitOfWork, Type returnType)
at Mindscape.LightSpeed.Linq.LinqQueryProvider.Execute(Expression expression)
at Mindscape.LightSpeed.Linq.LinqQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
at Mindscape.LightSpeed.Linq.LinqQuery`1.GetEnumerator()
at EditorMaintenance.frmMain.RadioButton1_CheckedChanged(Object sender, EventArgs e) in C:\Projects\Utilities\EditorMaintenance\EditorMaintenance\frmMain.vb:line 212
at System.Windows.Forms.RadioButton.OnCheckedChanged(EventArgs e)
at System.Windows.Forms.RadioButton.set_Checked(Boolean value)
at System.Windows.Forms.RadioButton.OnClick(EventArgs e)
at System.Windows.Forms.RadioButton.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at EditorMaintenance.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Here is the Function as it was generated by lightSpeed:
Public Overrides Function GetHashCode() As Integer
Dim hashCode As Integer = 0
hashCode = 19 * hashCode + If(_owner Is Nothing, 0, _owner.GetHashCode())
hashCode = 19 * hashCode + If(_tableName Is Nothing, 0, _tableName.GetHashCode())
hashCode = 19 * hashCode + If(_spatialColumn Is Nothing, 0, _spatialColumn.GetHashCode())
Return hashCode
End Function
It is complaining on the _tableName line... The current Hashcode is: 38749400 and the _tablenme.GetHashCode returns: 1675720440, so that the multiplication of the hashcode + the tablename's hash code it TOO big... I've tried to lower the Multiplier (19) to other smaller prime numbers, but nothing seems to work...
So I'm figuring that I'll need to modify said function to fix this problem... Any Ideas as to what I need to do to FIX this???
Using Visual Studio 2010/VB.Net either 3.5 or 4.0 framework, Oracle 10, LightSpeed 4
Thanks in advance,
Kevin Orcutt,
GIS Developer/Consultant,
City of Cincinnati - Cincinnati Area GIS (CAGIS),
(513) 850-1335 (cell),
Kevin.Orcutt@cincinnati-oh.gov,
korcutt@zoomtown.com,
www.cagis.org