After some intense googling with bing I found that the method I need
is just private.

Re:
> FindDirty won't function without a SessionScope: No shared 1st level cache,
> no dirty checking...
Why then does the code below work then?

[code in my base class that inherits from ActiveRecordValidationBase]

    'from: http://forum.castleproject.org/viewtopic.php?p=13855&highlight=
    Private Shared sf_GetValuesIndexByKeyMethodInfo As
System.Reflection.MethodInfo
    Private Shared ReadOnly GETVALUESINDEXBYKEY As String =
"GetValuesIndexByKey"

    Private Function GetIndexOfKey(ByVal dictionary As
System.Collections.IDictionary, ByVal key As String) As Integer
        ' Cache the method info.
        If sf_GetValuesIndexByKeyMethodInfo Is Nothing Then
            sf_GetValuesIndexByKeyMethodInfo =
dictionary.[GetType]().GetMethod(GETVALUESINDEXBYKEY,
System.Reflection.BindingFlags.Instance Or
System.Reflection.BindingFlags.NonPublic)
        End If

        ' Invoke the method on the dictionary and return the index.
        Dim index As Object =
sf_GetValuesIndexByKeyMethodInfo.Invoke(dictionary, New Object()
{key})
        Return System.Convert.ToInt32(index)
    End Function

    Protected Overrides Function FindDirty(ByVal id As Object, ByVal
previousState As System.Collections.IDictionary, ByVal currentState As
System.Collections.IDictionary, ByVal types() As
NHibernate.Type.IType) As Integer()
        Dim idxs As New List(Of Integer)


        For Each k As String In previousState.Keys
            If _changedattribs.Contains(k) Then '_changedattribs is
from my own dirty attribs tracking
                idxs.Add(GetIndexOfKey(previousState, k))
            End If
        Next

        Return idxs.ToArray()
    End Function

==============================
and in interest of full disclosure my save method:

    Private Sub Save()
        Me.Validate()
        Me.JobcardBindingSource.EndEdit()
        Me.JobdetailsBindingSource.EndEdit()

        'SessionScopeKiller to remove any session scopes hanging around
        Do While SessionScope.Current IsNot Nothing
            SessionScope.Current.Dispose()
        Loop

        For Each d As Jobdetails In _jobcard.Details
            d.Save()
        Next

        _jobcard.Save()
end Sub

[code end]



On Thu, Aug 6, 2009 at 7:19 PM, Markus Zywitza<[email protected]> wrote:
> FindDirty won't function without a SessionScope: No shared 1st level cache,
> no dirty checking...
>
> -Markus
>
> 2009/8/6 Gerdus van Zyl <[email protected]>
>>
>> I have pretty much given up on using a sessionscope or long lived
>> session at all. Currently I just let activerecord create a new scope
>> every time it's needed.
>>
>> Now I just need to fix the dynamicupdate issue. I think FindDirty is
>> what I need but I can't seem to get it working.
>> AR wraps the  currentState using DictionaryAdapter where I am
>> struggling to get the integer index out again.
>>
>> thank you for all the help :-)
>>
>> ~G
>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to