Compartir a través de


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

Compares one object identifier part with another specified object identifier part.

Namespace:  Microsoft.VisualStudio.Data.AdoDotNet
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'Declaración
Public Overrides Function Compare ( _
    typeName As String, _
    identifier As Object(), _
    identifierPart As Integer, _
    value As Object _
) As Integer
public override int Compare(
    string typeName,
    Object[] identifier,
    int identifierPart,
    Object value
)
public:
virtual int Compare(
    String^ typeName, 
    array<Object^>^ identifier, 
    int identifierPart, 
    Object^ value
) override
abstract Compare : 
        typeName:string * 
        identifier:Object[] * 
        identifierPart:int * 
        value:Object -> int 
override Compare : 
        typeName:string * 
        identifier:Object[] * 
        identifierPart:int * 
        value:Object -> int 
public override function Compare(
    typeName : String, 
    identifier : Object[], 
    identifierPart : int, 
    value : Object
) : int

Parameters

  • identifier
    Type: array<System.Object[]
    The identifier of an object of the type specified by typeName parameter.
  • 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
Returns less than zero in cases where the identifier part is less than the specified value. Returns zero if the identifier part is equal to the specified value. Returns greater than zero if the identifier part is greater than the specified value.

Exceptions

Exception Condition
ArgumentNullException

The typeName and/or identifier parameter is null.

ArgumentOutOfRangeException

The identifier parameter is less than zero or greater than or equal to the number of elements in the identifier array.

Remarks

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

By passing in the complete source identifier, certain complex situations can be handled. For example, recent versions of Microsoft SQL Server will allow the server as a whole to be case sensitive on identifier comparison while a particular database on the server may be case insensitive, or vice versa. This means that when comparing the schema or name of a table (which appears as the second and third parts in a full table identifier, the first part being the database), the implementation of this method must use the first identifier part to figure out which database the table is in, and thus, what kind of comparison to use.

This implementation retrieves the IdentifierCase data source information property from the ADO.NET data source information table and uses the value to determine whether a case-sensitive comparison is warranted.

.NET Framework Security

See Also

Reference

AdoDotNetObjectItemComparer Class

Compare Overload

Microsoft.VisualStudio.Data.AdoDotNet Namespace

IComparable

Compare