Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DLinq / Dlinq / SqlClient / Common / SqlServer2KCompatibilityCheck.cs / 1 / SqlServer2KCompatibilityCheck.cs
using System; using System.Collections.ObjectModel; using System.Text; namespace System.Data.Linq.SqlClient { ////// Methods for checking whethe a query was compatible with the /// server it will be sent to. /// static internal class SqlServerCompatibilityCheck { ////// Private visitor class checks each node for compatibility annotations. /// private class Visitor : SqlVisitor { private SqlProvider.ProviderMode provider; internal SqlNodeAnnotations annotations; internal Visitor(SqlProvider.ProviderMode provider) { this.provider = provider; } ////// The reasons why this query is not 2K compatible. /// internal Collectionreasons = new Collection (); internal override SqlNode Visit(SqlNode node) { if (annotations.NodeIsAnnotated(node)) { foreach (SqlNodeAnnotation annotation in annotations.Get(node)) { SqlServerCompatibilityAnnotation ssca = annotation as SqlServerCompatibilityAnnotation; if (ssca != null && ssca.AppliesTo(provider)) { reasons.Add(annotation.Message); } } } return base.Visit(node); } } /// /// Checks whether the given node is supported on the given server. /// internal static void ThrowIfUnsupported(SqlNode node, SqlNodeAnnotations annotations, SqlProvider.ProviderMode provider) { // Check to see whether there's at least one SqlServerCompatibilityAnnotation. if (annotations.HasAnnotationType(typeof(SqlServerCompatibilityAnnotation))) { Visitor visitor = new Visitor(provider); visitor.annotations = annotations; visitor.Visit(node); // If any messages were recorded, then throw an exception. if (visitor.reasons.Count > 0) { throw Error.ExpressionNotSupportedForSqlServerVersion(visitor.reasons); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.ObjectModel; using System.Text; namespace System.Data.Linq.SqlClient { ////// Methods for checking whethe a query was compatible with the /// server it will be sent to. /// static internal class SqlServerCompatibilityCheck { ////// Private visitor class checks each node for compatibility annotations. /// private class Visitor : SqlVisitor { private SqlProvider.ProviderMode provider; internal SqlNodeAnnotations annotations; internal Visitor(SqlProvider.ProviderMode provider) { this.provider = provider; } ////// The reasons why this query is not 2K compatible. /// internal Collectionreasons = new Collection (); internal override SqlNode Visit(SqlNode node) { if (annotations.NodeIsAnnotated(node)) { foreach (SqlNodeAnnotation annotation in annotations.Get(node)) { SqlServerCompatibilityAnnotation ssca = annotation as SqlServerCompatibilityAnnotation; if (ssca != null && ssca.AppliesTo(provider)) { reasons.Add(annotation.Message); } } } return base.Visit(node); } } /// /// Checks whether the given node is supported on the given server. /// internal static void ThrowIfUnsupported(SqlNode node, SqlNodeAnnotations annotations, SqlProvider.ProviderMode provider) { // Check to see whether there's at least one SqlServerCompatibilityAnnotation. if (annotations.HasAnnotationType(typeof(SqlServerCompatibilityAnnotation))) { Visitor visitor = new Visitor(provider); visitor.annotations = annotations; visitor.Visit(node); // If any messages were recorded, then throw an exception. if (visitor.reasons.Count > 0) { throw Error.ExpressionNotSupportedForSqlServerVersion(visitor.reasons); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Table.cs
- _BaseOverlappedAsyncResult.cs
- DynamicControl.cs
- ChildrenQuery.cs
- WebResourceAttribute.cs
- ClientSideProviderDescription.cs
- Int64.cs
- EventDescriptor.cs
- OutputChannel.cs
- ItemContainerPattern.cs
- ClickablePoint.cs
- OpenFileDialog.cs
- DocumentReference.cs
- Setter.cs
- DialogBaseForm.cs
- ThousandthOfEmRealPoints.cs
- DoubleLinkList.cs
- IsolationInterop.cs
- DashStyle.cs
- ConfigurationElement.cs
- _NegoStream.cs
- DesigntimeLicenseContextSerializer.cs
- InvokeMemberBinder.cs
- ToolboxComponentsCreatingEventArgs.cs
- SessionSwitchEventArgs.cs
- StrongNamePublicKeyBlob.cs
- ItemContainerGenerator.cs
- ModifierKeysValueSerializer.cs
- PropertyRef.cs
- PropertySourceInfo.cs
- ZoneButton.cs
- AutomationElement.cs
- QuaternionRotation3D.cs
- Compiler.cs
- DbProviderServices.cs
- BufferAllocator.cs
- CqlGenerator.cs
- HttpPostServerProtocol.cs
- MobileCapabilities.cs
- StatusBarDrawItemEvent.cs
- StringUtil.cs
- GuidConverter.cs
- HandledMouseEvent.cs
- Scene3D.cs
- MemberHolder.cs
- XPathException.cs
- XamlInt32CollectionSerializer.cs
- CacheAxisQuery.cs
- DbConnectionInternal.cs
- ContentTextAutomationPeer.cs
- PowerModeChangedEventArgs.cs
- SpecularMaterial.cs
- MD5HashHelper.cs
- SoapInteropTypes.cs
- SerializationFieldInfo.cs
- Rule.cs
- XmlWriter.cs
- PeerCollaborationPermission.cs
- XmlNavigatorStack.cs
- ContractTypeNameCollection.cs
- EditorZoneDesigner.cs
- EventPropertyMap.cs
- ThicknessKeyFrameCollection.cs
- ValueTypeFixupInfo.cs
- WindowsListViewSubItem.cs
- ParseElementCollection.cs
- isolationinterop.cs
- CryptoConfig.cs
- MimeImporter.cs
- WebServiceData.cs
- SQLDateTimeStorage.cs
- CompositeTypefaceMetrics.cs
- ZoneLinkButton.cs
- HtmlHead.cs
- HttpContext.cs
- ProcessModuleCollection.cs
- SqlMethodCallConverter.cs
- FastEncoderWindow.cs
- XmlReflectionImporter.cs
- smtppermission.cs
- RuleSet.cs
- HttpException.cs
- AppDomainUnloadedException.cs
- TypeSystemProvider.cs
- RemoteAsymmetricSignatureFormatter.cs
- ListViewItem.cs
- UInt32.cs
- Message.cs
- DataGridViewTextBoxColumn.cs
- TraceContextRecord.cs
- XNodeNavigator.cs
- NotificationContext.cs
- IUnknownConstantAttribute.cs
- PropertyDescriptorCollection.cs
- MarkupProperty.cs
- KeyBinding.cs
- DecoderReplacementFallback.cs
- PixelFormats.cs
- StringUtil.cs
- InstalledFontCollection.cs