CSharpTest.Net
ToSqlGuid Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Data Namespace > DbGuid Structure : ToSqlGuid Method

Glossary Item Box

Used to swap the first 8 bytes with the last 8 bytes for SQL-Server optimization. The inverse operation can be performed by calling ToSequenceGuid() on the result. If IsSqlGuid is already True this call has no effect and returns the same value.

Syntax

Visual Basic (Declaration) 
Public Function ToSqlGuid() As DbGuid
C# 
public DbGuid ToSqlGuid()

Example

Library/Library.Test/TestDbGuid.cs

C#Copy Code
DbGuid testA = DbGuid.NewGuid();
TestEquality(testA, testA, true);
TestEquality(testA, DbGuid.NewGuid(), false);
TestEquality(testA, new DbGuid(Guid.NewGuid()), false);
TestEquality(testA, testA.ToSqlGuid(), true);
TestEquality(testA, testA.ToSqlGuid().ToSequenceGuid(), true);
VB.NETCopy Code
Dim testA As DbGuid = DbGuid.NewGuid()
TestEquality(testA, testA, True)
TestEquality(testA, DbGuid.NewGuid(), False)
TestEquality(testA, New DbGuid(Guid.NewGuid()), False)
TestEquality(testA, testA.ToSqlGuid(), True)
TestEquality(testA, testA.ToSqlGuid().ToSequenceGuid(), True)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys