Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlVersion.cs / 2 / SqlVersion.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Text; using System.Globalization; using System.Data; using System.Data.Common; using System.Data.SqlClient; namespace System.Data.SqlClient { ////// This enum describes the current server version /// internal enum SqlVersion { ////// Sql Server 8 /// Sql8 = 80, ////// Sql Server 9 /// Sql9 = 90, ////// Sql Server 10 /// Sql10 = 100, // higher versions go here } ////// This class is a simple utility class that determines the sql version from the /// connection /// internal static class SqlVersionUtils { ////// Get the SqlVersion from the connection. Returns one of Sql8, Sql9, Sql10 /// /// current sql connection ///Sql Version for the current connection internal static SqlVersion GetSqlVersion(SqlConnection connection) { if (connection.IsYukonOrNewer) { if (connection.IsKatmaiOrNewer) { return SqlVersion.Sql10; } else { return SqlVersion.Sql9; } } else { System.Diagnostics.Debug.Assert(connection.ServerVersion.StartsWith("08.", StringComparison.Ordinal), "not version 8"); return SqlVersion.Sql8; } } internal static string GetVersionHint(SqlVersion version) { switch(version) { case SqlVersion.Sql8: return SqlProviderManifest.TokenSql8; case SqlVersion.Sql9: return SqlProviderManifest.TokenSql9; case SqlVersion.Sql10: return SqlProviderManifest.TokenSql10; default: throw EntityUtil.Argument(Entity.Strings.UnableToDetermineStoreVersion); } } internal static SqlVersion GetSqlVersion(string versionHint) { if (!string.IsNullOrEmpty(versionHint)) { switch (versionHint) { case SqlProviderManifest.TokenSql8: return SqlVersion.Sql8; case SqlProviderManifest.TokenSql9: return SqlVersion.Sql9; case SqlProviderManifest.TokenSql10: return SqlVersion.Sql10; } } throw EntityUtil.Argument(Entity.Strings.UnableToDetermineStoreVersion); } internal static bool IsPreKatmai(SqlVersion sqlVersion) { return sqlVersion == SqlVersion.Sql8 || sqlVersion == SqlVersion.Sql9; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Text; using System.Globalization; using System.Data; using System.Data.Common; using System.Data.SqlClient; namespace System.Data.SqlClient { ////// This enum describes the current server version /// internal enum SqlVersion { ////// Sql Server 8 /// Sql8 = 80, ////// Sql Server 9 /// Sql9 = 90, ////// Sql Server 10 /// Sql10 = 100, // higher versions go here } ////// This class is a simple utility class that determines the sql version from the /// connection /// internal static class SqlVersionUtils { ////// Get the SqlVersion from the connection. Returns one of Sql8, Sql9, Sql10 /// /// current sql connection ///Sql Version for the current connection internal static SqlVersion GetSqlVersion(SqlConnection connection) { if (connection.IsYukonOrNewer) { if (connection.IsKatmaiOrNewer) { return SqlVersion.Sql10; } else { return SqlVersion.Sql9; } } else { System.Diagnostics.Debug.Assert(connection.ServerVersion.StartsWith("08.", StringComparison.Ordinal), "not version 8"); return SqlVersion.Sql8; } } internal static string GetVersionHint(SqlVersion version) { switch(version) { case SqlVersion.Sql8: return SqlProviderManifest.TokenSql8; case SqlVersion.Sql9: return SqlProviderManifest.TokenSql9; case SqlVersion.Sql10: return SqlProviderManifest.TokenSql10; default: throw EntityUtil.Argument(Entity.Strings.UnableToDetermineStoreVersion); } } internal static SqlVersion GetSqlVersion(string versionHint) { if (!string.IsNullOrEmpty(versionHint)) { switch (versionHint) { case SqlProviderManifest.TokenSql8: return SqlVersion.Sql8; case SqlProviderManifest.TokenSql9: return SqlVersion.Sql9; case SqlProviderManifest.TokenSql10: return SqlVersion.Sql10; } } throw EntityUtil.Argument(Entity.Strings.UnableToDetermineStoreVersion); } internal static bool IsPreKatmai(SqlVersion sqlVersion) { return sqlVersion == SqlVersion.Sql8 || sqlVersion == SqlVersion.Sql9; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlSchemaObject.cs
- CodeMemberProperty.cs
- backend.cs
- PartitionedStreamMerger.cs
- RegexInterpreter.cs
- CodeDirectoryCompiler.cs
- MessageQueueTransaction.cs
- SimpleTextLine.cs
- UInt32Storage.cs
- UnmanagedMemoryStream.cs
- HttpBrowserCapabilitiesWrapper.cs
- clipboard.cs
- QilParameter.cs
- ScrollBarAutomationPeer.cs
- InternalBufferOverflowException.cs
- WebResourceAttribute.cs
- TypeHelper.cs
- SecurityBindingElementImporter.cs
- CheckedPointers.cs
- FixedSOMTable.cs
- CodeAttributeArgumentCollection.cs
- ArithmeticException.cs
- EnumerableCollectionView.cs
- ObjectContextServiceProvider.cs
- BrushValueSerializer.cs
- XmlProcessingInstruction.cs
- SessionStateModule.cs
- CallbackValidator.cs
- DesignerAttribute.cs
- Operator.cs
- FileRecordSequenceCompletedAsyncResult.cs
- HttpGetServerProtocol.cs
- TextTreeRootTextBlock.cs
- RunInstallerAttribute.cs
- CodeTypeParameter.cs
- Trigger.cs
- PlainXmlWriter.cs
- SelectionEditor.cs
- DocumentEventArgs.cs
- PrintPreviewGraphics.cs
- UInt64Storage.cs
- SqlHelper.cs
- SoapRpcMethodAttribute.cs
- InnerItemCollectionView.cs
- TypeElementCollection.cs
- DateTimeConverter2.cs
- GroupAggregateExpr.cs
- HierarchicalDataBoundControlAdapter.cs
- EditorZone.cs
- String.cs
- EDesignUtil.cs
- FileUpload.cs
- RadioButtonBaseAdapter.cs
- DecoderBestFitFallback.cs
- VirtualizingPanel.cs
- MemberAssignmentAnalysis.cs
- TypeUsageBuilder.cs
- ValidatorCollection.cs
- GeometryHitTestResult.cs
- UnhandledExceptionEventArgs.cs
- AppSettingsExpressionBuilder.cs
- CompilerTypeWithParams.cs
- SiteMembershipCondition.cs
- CompilerCollection.cs
- ConnectionPoint.cs
- OdbcEnvironment.cs
- UpDownEvent.cs
- EnumUnknown.cs
- PropertyGridDesigner.cs
- PrintPageEvent.cs
- ResXResourceReader.cs
- figurelength.cs
- GlobalizationSection.cs
- MutableAssemblyCacheEntry.cs
- ListViewUpdateEventArgs.cs
- UIElement.cs
- VarRemapper.cs
- IBuiltInEvidence.cs
- WmpBitmapDecoder.cs
- XmlBaseWriter.cs
- EntityDataSourceColumn.cs
- TreeBuilderBamlTranslator.cs
- StorageConditionPropertyMapping.cs
- PolicyUtility.cs
- ByteAnimationBase.cs
- BitStack.cs
- SynchronizationLockException.cs
- Inline.cs
- ConstraintStruct.cs
- COMException.cs
- HtmlListAdapter.cs
- Size.cs
- ELinqQueryState.cs
- ProviderSettingsCollection.cs
- RangeValuePatternIdentifiers.cs
- ScrollEventArgs.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- PrintDialog.cs
- Matrix.cs
- OleDbDataAdapter.cs