Implementing IConcurrencyPredicateFactory in VB.NET

Posts   
 
    
BenR
User
Posts: 5
Joined: 13-Jun-2007
# Posted on: 26-Jul-2007 01:30:38   

After reviewing all the concurrency-related threads, I took a stab at creating a class that implements the IConcurrencyPredicateFactory interface (posted below). The issue is that VS2005 is telling me that I must implement the CreatePredicate() method, but it's in there! The method signature looks identical to what is required (I even tried copying the signature from the error message to be sure). I'm sure it's something stupid, but if any VB guys have dealt with this I could use some help. Thanks!

The code:

Imports SD.LLBLGen.Pro.ORMSupportClasses

<Serializable()> _
Public Class ConcurrencyPredicateFactory
    Implements IConcurrencyPredicateFactory

    Private mTimestampField As EntityField

    'constructor
    Public Sub ConcurrencyPredicateFactory(ByVal timestampField As IEntityField)
        mTimestampField = CType(timestampField, EntityField)
    End Sub

    Public Function CreatePredicate(ByVal predicateTypeToCreate As ConcurrencyPredicateType, ByVal containingEntity As Object) As IPredicateExpression
        Dim toReturn As IPredicateExpression = New PredicateExpression()
        Dim entity As EntityBase = CType(containingEntity, EntityBase)

        Select Case predicateTypeToCreate
            Case ConcurrencyPredicateType.Save
                toReturn.Add(mTimestampField = entity.Fields("Timestamp").DbValue)
        End Select

        Return toReturn
    End Function

End Class

The Error:

Class 'ConcurrencyPredicateFactory' must implement 'Function CreatePredicate(predicateTypeToCreate As ConcurrencyPredicateType, containingEntity As Object) As IPredicateExpression' for interface 'SD.LLBLGen.Pro.ORMSupportClasses.IConcurrencyPredicateFactory'

The Environment: VS2005, LLBLGen Pro v2.0 (latest build), Self Servicing

mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 26-Jul-2007 01:59:04   

I think you need to add the "Implements..."


Public Function CreatePredicate(ByVal predicateTypeToCreate As ConcurrencyPredicateType, ByVal containingEntity As Object) As IPredicateExpression Implements IConcurrencyPredicateFactory.CreatePredicate

BenR
User
Posts: 5
Joined: 13-Jun-2007
# Posted on: 26-Jul-2007 17:25:06   

mikeg22 wrote:

I think you need to add the "Implements..."


Public Function CreatePredicate(ByVal predicateTypeToCreate As ConcurrencyPredicateType, ByVal containingEntity As Object) As IPredicateExpression Implements IConcurrentcyPredicateFactory.CreatePredicate

flushed D'oh, that was it exactly - Thank-you!

mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 26-Jul-2007 17:30:46   

BenR wrote:

mikeg22 wrote:

I think you need to add the "Implements..."


Public Function CreatePredicate(ByVal predicateTypeToCreate As ConcurrencyPredicateType, ByVal containingEntity As Object) As IPredicateExpression Implements IConcurrentcyPredicateFactory.CreatePredicate

flushed D'oh, that was it exactly - Thank-you!

Now ask me why you have to do this (add the implements when your intention was clear)...I have absolutely no idea! smile