RetrieveMatch method

Nov 26, 2009 at 6:52 AM

Hi,

I try to used the RetrieveMatch method as follow.

public OrganigramaEntity GetUnitateFromOrganigrama(int codUnitate)

{ if (broker.RetrieveMatchExists(OrganigramaEntity.ByIdCodUnitate(codUnitate)))

return (OrganigramaEntity) broker.RetrieveMatch( OrganigramaEntity.ByIdCodUnitate(codUnitate));

else <font size="2">

 r

</font>

eturn null;

}

I know that in the OrganigramaEntity I have rows who satisfy the condition ByIdCodUnitate

internal static Criteria ByIdCodUnitate(int codunitate) {

return new Expression(typeof(OrganigramaEntity),OrganigramaEntity.GetField(typeof(OrganigramaEntity), OrganigramaEntity.COL_CODUNITATE)CriteriaOperator.Equal, codunitate);

 }

The boolean test  "broker.RetrieveMatchExists(OrganigramaEntity.ByIdCodUnitate(codUnitate))) " from IF clause return true but the method broker.RetrieveMatch throw a critical exception.

If I used method broker.RetrieveDataSet everything it's fine but my question is ... Why the RetrieveMatch method failed in this case??

10x,

Daniel.

 

Coordinator
Nov 28, 2009 at 11:43 PM

Any detail on the actual exception (and Exception chain, stack trace, etc) to help me help you?

I don't have bugs reported on behavior like this.....  so any help would be welcome.

Best regards,

Andres.

Nov 29, 2009 at 12:45 PM

Hi,

I catch the same exception using the follow lines of code: 

public IList<PersoanaEntity> GetPersoaneFromMultimeUnitati(IList<int> coduriUnitati)

{ if (broker.RetrieveMatchExists(PersoanaEntity.ByMultimeCodUnitate(coduriUnitati)))

return broker.RetrieveMatches<PersoanaEntity>(PersoanaEntity.ByMultimeCodUnitate(coduriUnitati));

else <font size="2">

 

</font>

return null;

}

The test of RetrieveMatchExists return true, but when I want to return the matches of PersoanaEntity having a IList parameter the folow exception was throwed:

Retina.RetinaCriticalException was unhandled
  Message="Unexpected critical exception occurred. Please check the inner exception for more details."
  Source="Retina.Core"
  StackTrace:
       at Retina.DataStoreBrokers.Enterprise.DataStoreBroker.RetrieveMatches[T](Criteria criteria)
       at BusinessHR.UI.Actualizare.FctManageriale.BussActualizareFctManageriale.GetPersoaneFromMultimeUnitati(IList`1 coduriUnitati) in D:\WORK_HR\HumanResourcesSolution\BusinessHR\UI\Actualizare\FctManageriale\BussActualizareFctManageriale.cs:line 38
       at ResurseUmane.UI.Actualizare.FctManageriale.FrmFunctiiManageriale.btnAdauga_Click(Object sender, EventArgs e) in D:\WORK_HR\HumanResourcesSolution\ResurseUmane\UI\Actualizare\FctManageriale\FrmFunctiiManageriale.cs:line 187
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.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.Button.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(Int32 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 System.Windows.Forms.Application.RunDialog(Form form)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.Form.ShowDialog()
       at ResurseUmane.UI.Principal.FrmPrincipala.btnActualizareFunctiiManageriale_Click(Object sender, EventArgs e) in D:\WORK_HR\HumanResourcesSolution\ResurseUmane\UI\Principal\FrmPrincipala.cs:line 91
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.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.Button.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(Int32 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 System.Windows.Forms.Application.RunDialog(Form form)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.Form.ShowDialog()
       at ResurseUmane.FrmAutentifica.btnAccepta_Click(Object sender, EventArgs e) in D:\WORK_HR\HumanResourcesSolution\ResurseUmane\UI\Autentificare\FrmAutentifica.cs:line 85
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.PerformClick()
       at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
       at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
       at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
       at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
       at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
       at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 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 System.Windows.Forms.Application.Run(Form mainForm)
       at ResurseUmane.Program.Main() in D:\WORK_HR\HumanResourcesSolution\ResurseUmane\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly 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)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.NullReferenceException
       Message="Object reference not set to an instance of an object."
       Source="Retina.Core"
       StackTrace:
            at Retina.EntityMember.SetValue(Entity entity, Object dataValue)
            at Retina.EntityStorageDefn.PopulateEntity(IDataReader reader, Entity entity, ITxnContext txnContext, Boolean readPrimaryKey, Int32 maxDepth, Int32 currentDepth, IdentityMap identityMap, Boolean fetchSingleRow)
            at Retina.BaseEntityPersister.RetrieveMatches[T](ITxnContext txnContext, Object appContext, Criteria criteria, Int32 maxDepth, Int32 currentDepth)
            at Retina.DataStoreBrokers.InternalDataStoreBroker.RetrieveMatches[T](ITxnContext txnContext, Object appContext, Criteria criteria, Int32 maxDepth)
            at Retina.DataStoreBrokers.Enterprise.Reader.RetrieveMatches[T](ITxnContext txnContext, Object appContext, Criteria criteria, Int32 maxDepth)
            at Retina.DataStoreBrokers.Enterprise.TxnContext.RetrieveMatches[T](Object appContext, Criteria criteria, Int32 maxDepth)
            at Retina.DataStoreBrokers.Enterprise.DataStoreBroker.RetrieveMatches[T](Criteria criteria)
       InnerException:

 

In the event viewer in application event tab the error was:

Event Type: Error
Event Source: Retina
Event Category: None
Event ID: 0
Date:  11/29/2009
Time:  3:39:58 PM
User:  N/A
Computer: DEPTINFO187
Description:

 


1) Exception Information
*********************************************
Exception Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void SetValue(Retina.Entity, System.Object)
HelpLink: NULL
Source: Retina.Core

StackTrace Information
*********************************************
   at Retina.EntityMember.SetValue(Entity entity, Object dataValue)
   at Retina.EntityStorageDefn.PopulateEntity(IDataReader reader, Entity entity, ITxnContext txnContext, Boolean readPrimaryKey, Int32 maxDepth, Int32 currentDepth, IdentityMap identityMap, Boolean fetchSingleRow)
   at Retina.BaseEntityPersister.RetrieveMatches[T](ITxnContext txnContext, Object appContext, Criteria criteria, Int32 maxDepth, Int32 currentDepth)
   at Retina.DataStoreBrokers.InternalDataStoreBroker.RetrieveMatches[T](ITxnContext txnContext, Object appContext, Criteria criteria, Int32 maxDepth)
   at Retina.DataStoreBrokers.Enterprise.Reader.RetrieveMatches[T](ITxnContext txnContext, Object appContext, Criteria criteria, Int32 maxDepth)
   at Retina.DataStoreBrokers.Enterprise.TxnContext.RetrieveMatches[T](Object appContext, Criteria criteria, Int32 maxDepth)
   at Retina.DataStoreBrokers.Enterprise.DataStoreBroker.RetrieveMatches[T](Criteria criteria)


Assembly version: 2.0.0.0
RuntimeVersion: v2.0.50727
Compilation: RELEASE
Assembly file version: 2.0.020924.0

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 52 65 74 69 6e 61 2e 55   Retina.U
0008: 74 69 6c 69 74 79 2e 45   tility.E
0010: 76 65 6e 74 4c 6f 67 48   ventLogH
0018: 65 6c 70 65 72 2c 20 52   elper, R
0020: 65 74 69 6e 61 2e 43 6f   etina.Co
0028: 72 65 2c 20 56 65 72 73   re, Vers
0030: 69 6f 6e 3d 32 2e 30 2e   ion=2.0.
0038: 30 2e 30 2c 20 43 75 6c   0.0, Cul
0040: 74 75 72 65 3d 6e 65 75   ture=neu
0048: 74 72 61 6c 2c 20 50 75   tral, Pu
0050: 62 6c 69 63 4b 65 79 54   blicKeyT
0058: 6f 6b 65 6e 3d 36 31 65   oken=61e
0060: 34 62 35 32 37 35 63 35   4b5275c5
0068: 38 31 30 33 31            81031  

IN the output window I have the folow message:

A first chance exception of type 'Retina.RetinaCriticalException' occurred in Retina.Core.dll

 

I hope that this information help you.

 

10x.

 

Daniel.