Delen via


IVsDataObjectMemberComparer.Compare Method (String, array<Object , Int32, Object)

When implemented by a class, compares one object identifier part with another specified object identifier part.

Namespace:  Microsoft.VisualStudio.Data.Services.SupportEntities
Assembly:  Microsoft.VisualStudio.Data.Services (in Microsoft.VisualStudio.Data.Services.dll)

Syntax

'Declaration
Function Compare ( _
    typeName As String, _
    identifier As Object(), _
    identifierPart As Integer, _
    value As Object _
) As Integer
int Compare(
    string typeName,
    Object[] identifier,
    int identifierPart,
    Object value
)
int Compare(
    String^ typeName, 
    array<Object^>^ identifier, 
    int identifierPart, 
    Object^ value
)
abstract Compare : 
        typeName:string * 
        identifier:Object[] * 
        identifierPart:int * 
        value:Object -> int
function Compare(
    typeName : String, 
    identifier : Object[], 
    identifierPart : int, 
    value : Object
) : int

Parameters

  • identifier
    Type: array<System.Object[]

    An array of identifier parts that identify the data object.

  • identifierPart
    Type: System.Int32

    The zero-based index into the identifier array indicating which part of the identifier to compare.

  • value
    Type: System.Object

    A value to compare the identifier part against.

Return Value

Type: System.Int32
A value less than zero in cases where the identifier part is less than the specified value; zero if the identifier part is equal to the specified value; a value greater than zero if the identifier part is greater than the specified value.

Remarks

This method should use the same comparison rules as the data source to ensure the correct uniqueness of objects on the client side.

You can handle certain complex situations by passing in the complete source identifier. For example, recent versions of Microsoft SQL Server allow the instance of SQL Server as a whole to be case sensitive on identifier comparison, whereas a particular database on the instance of SQL Server can be case insensitive, or vice versa. This means that when comparing the schema or name of a table (which appear as the second and third parts, respectively, in a full table identifier, the first part being the database), the implementation of this method must use the first identifier part to determine which database the table is in, and thus, what kind of comparison to use.

.NET Framework Security

See Also

Reference

IVsDataObjectMemberComparer Interface

Compare Overload

Microsoft.VisualStudio.Data.Services.SupportEntities Namespace