Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlVersion.cs / 1 / 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
- DataServiceQueryProvider.cs
- IntSecurity.cs
- OperatorExpressions.cs
- Preprocessor.cs
- ChannelTerminatedException.cs
- TextRenderingModeValidation.cs
- SqlErrorCollection.cs
- JavaScriptObjectDeserializer.cs
- LinqDataSourceContextEventArgs.cs
- Transaction.cs
- MappingModelBuildProvider.cs
- ProcessThreadCollection.cs
- Transactions.cs
- CollectionContainer.cs
- CaseInsensitiveHashCodeProvider.cs
- UnsafeNativeMethodsMilCoreApi.cs
- WebPartManager.cs
- ElapsedEventArgs.cs
- FormatConvertedBitmap.cs
- Pen.cs
- ScrollBar.cs
- WindowsIPAddress.cs
- Int16KeyFrameCollection.cs
- Action.cs
- RelationshipEnd.cs
- DataShape.cs
- ScriptReferenceBase.cs
- HttpCacheVary.cs
- ModelItemCollection.cs
- ZoneLinkButton.cs
- WizardPanel.cs
- errorpatternmatcher.cs
- IndexOutOfRangeException.cs
- PropertyChangingEventArgs.cs
- smtpconnection.cs
- QueryExtender.cs
- PointHitTestResult.cs
- Set.cs
- PreloadedPackages.cs
- ValidatingPropertiesEventArgs.cs
- ZipQueryOperator.cs
- ToolStripItemDataObject.cs
- XPathNavigator.cs
- WindowsImpersonationContext.cs
- DataSourceComponent.cs
- DataRelationCollection.cs
- AutoResizedEvent.cs
- TimeSpan.cs
- GenericAuthenticationEventArgs.cs
- UIPermission.cs
- InvalidCommandTreeException.cs
- InputBindingCollection.cs
- WindowsFormsLinkLabel.cs
- FixedNode.cs
- SharedUtils.cs
- ProviderCollection.cs
- WsatAdminException.cs
- MetaChildrenColumn.cs
- BufferBuilder.cs
- SrgsSemanticInterpretationTag.cs
- ViewBox.cs
- BinaryFormatter.cs
- Stroke2.cs
- ToolboxComponentsCreatedEventArgs.cs
- DataMemberFieldEditor.cs
- AlgoModule.cs
- InstancePersistenceContext.cs
- IProducerConsumerCollection.cs
- HashHelpers.cs
- QuaternionValueSerializer.cs
- TextTrailingWordEllipsis.cs
- ToolStripProgressBar.cs
- ImageAttributes.cs
- ClientEndpointLoader.cs
- RSAPKCS1KeyExchangeFormatter.cs
- XPathExpr.cs
- Transactions.cs
- ArgumentsParser.cs
- DbProviderFactoriesConfigurationHandler.cs
- EdmComplexPropertyAttribute.cs
- WebConfigurationFileMap.cs
- CodeRemoveEventStatement.cs
- WebPartConnectionsDisconnectVerb.cs
- RequestUriProcessor.cs
- FontFamilyConverter.cs
- NamedPipeAppDomainProtocolHandler.cs
- PropertyDescriptorCollection.cs
- ExternalFile.cs
- DependencySource.cs
- WebPart.cs
- Nodes.cs
- InstancePersistenceCommandException.cs
- WindowHideOrCloseTracker.cs
- Encoding.cs
- SessionStateUtil.cs
- ClientUrlResolverWrapper.cs
- SoapCodeExporter.cs
- SqlMultiplexer.cs
- ParseHttpDate.cs
- SoapElementAttribute.cs