Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlVersion.cs / 1305376 / SqlVersion.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- 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 [....] // @backupOwner [....] //--------------------------------------------------------------------- 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
- CqlGenerator.cs
- ButtonStandardAdapter.cs
- IdentityManager.cs
- LongValidatorAttribute.cs
- SecurityDescriptor.cs
- EventRoute.cs
- ZoneLinkButton.cs
- WindowsFormsHelpers.cs
- InheritanceContextHelper.cs
- DeclarativeCatalogPart.cs
- Vector3D.cs
- TextUtf8RawTextWriter.cs
- IUnknownConstantAttribute.cs
- LabelEditEvent.cs
- InheritedPropertyDescriptor.cs
- BuiltInExpr.cs
- TransactionChannelFactory.cs
- ToolboxItemAttribute.cs
- OdbcConnectionFactory.cs
- GlyphInfoList.cs
- WorkflowOperationAsyncResult.cs
- IdnMapping.cs
- DependencyPropertyChangedEventArgs.cs
- PrimaryKeyTypeConverter.cs
- MapPathBasedVirtualPathProvider.cs
- WindowsStartMenu.cs
- PipeStream.cs
- SqlCacheDependencyDatabaseCollection.cs
- ConsoleKeyInfo.cs
- ListView.cs
- DrawingBrush.cs
- AutomationElement.cs
- CaseExpr.cs
- Matrix3D.cs
- HttpListenerContext.cs
- DirectoryNotFoundException.cs
- XmlValidatingReaderImpl.cs
- SqlMethodAttribute.cs
- FormattedTextSymbols.cs
- Constraint.cs
- externdll.cs
- IIS7WorkerRequest.cs
- MissingMemberException.cs
- DataGridViewColumnEventArgs.cs
- SmiRequestExecutor.cs
- Attributes.cs
- DeviceContexts.cs
- DiagnosticStrings.cs
- ValidationEventArgs.cs
- X509CertificateChain.cs
- XmlDataSourceView.cs
- SignatureDescription.cs
- BoundPropertyEntry.cs
- CustomError.cs
- VisualBrush.cs
- SafeTimerHandle.cs
- DrawingImage.cs
- BlockCollection.cs
- FileIOPermission.cs
- ContextMarshalException.cs
- FullTextState.cs
- ToolStripContentPanel.cs
- SmiEventStream.cs
- SinglePageViewer.cs
- RelationshipConverter.cs
- PartitionedStream.cs
- SplineQuaternionKeyFrame.cs
- DataStreams.cs
- VSWCFServiceContractGenerator.cs
- HttpListenerRequestTraceRecord.cs
- BindingListCollectionView.cs
- ModuleBuilderData.cs
- AlternateView.cs
- DataKey.cs
- SectionRecord.cs
- Highlights.cs
- MatrixAnimationUsingKeyFrames.cs
- ProcessHostFactoryHelper.cs
- SymLanguageVendor.cs
- Style.cs
- CombinedGeometry.cs
- OutgoingWebResponseContext.cs
- XamlParser.cs
- ZipIORawDataFileBlock.cs
- ExternalFile.cs
- FacetEnabledSchemaElement.cs
- SafeFileMappingHandle.cs
- TypeLibConverter.cs
- CursorConverter.cs
- X509SubjectKeyIdentifierClause.cs
- XmlSchemaIdentityConstraint.cs
- SerializationObjectManager.cs
- OperatingSystem.cs
- PerformanceCounterPermission.cs
- ColumnClickEvent.cs
- BaseParser.cs
- MulticastDelegate.cs
- NegotiateStream.cs
- SelectedDatesCollection.cs
- SrgsElementFactoryCompiler.cs