Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- IOThreadTimer.cs
- serverconfig.cs
- ComponentDispatcherThread.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- ValuePatternIdentifiers.cs
- SchemeSettingElementCollection.cs
- WindowsAuthenticationModule.cs
- InternalMappingException.cs
- PassportAuthenticationEventArgs.cs
- TypeDelegator.cs
- TabPage.cs
- CorrelationTokenTypeConvertor.cs
- IImplicitResourceProvider.cs
- BadImageFormatException.cs
- DynamicResourceExtension.cs
- DrawingAttributeSerializer.cs
- BitSet.cs
- GridViewCancelEditEventArgs.cs
- SamlAttribute.cs
- WindowsListBox.cs
- MultiPageTextView.cs
- PaperSize.cs
- BehaviorService.cs
- SQLByte.cs
- ConfigViewGenerator.cs
- LinkedResourceCollection.cs
- ServiceModelExtensionElement.cs
- WebPartVerbsEventArgs.cs
- ToolZoneDesigner.cs
- InputMethod.cs
- TemplatePropertyEntry.cs
- HandlerFactoryWrapper.cs
- SerializationInfo.cs
- WorkflowApplicationException.cs
- BuildProviderAppliesToAttribute.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- WebPartHeaderCloseVerb.cs
- SerialErrors.cs
- TaskFileService.cs
- KeySpline.cs
- DataListItemCollection.cs
- ISessionStateStore.cs
- ResourcePart.cs
- IndependentAnimationStorage.cs
- DeferredReference.cs
- UnaryNode.cs
- CryptoKeySecurity.cs
- FilterableData.cs
- TableSectionStyle.cs
- CheckableControlBaseAdapter.cs
- TargetException.cs
- GeneralTransformGroup.cs
- StrokeIntersection.cs
- ReadOnlyTernaryTree.cs
- LogPolicy.cs
- FolderNameEditor.cs
- VisualBrush.cs
- MdImport.cs
- DataGridCaption.cs
- AssemblyHelper.cs
- KeyToListMap.cs
- Handle.cs
- FindCompletedEventArgs.cs
- _CookieModule.cs
- DbConnectionPool.cs
- PropertyDescriptorCollection.cs
- WebBrowserNavigatedEventHandler.cs
- CounterSample.cs
- Win32SafeHandles.cs
- DbConnectionOptions.cs
- UshortList2.cs
- Emitter.cs
- FixUp.cs
- TailCallAnalyzer.cs
- RSAOAEPKeyExchangeFormatter.cs
- ColorContextHelper.cs
- MenuRendererStandards.cs
- StubHelpers.cs
- WindowsPrincipal.cs
- XmlSchemaAny.cs
- MarkupCompiler.cs
- MdiWindowListItemConverter.cs
- GenericRootAutomationPeer.cs
- X509Utils.cs
- UserControlFileEditor.cs
- AdRotator.cs
- Viewport3DVisual.cs
- Bits.cs
- FontStretches.cs
- TextTrailingWordEllipsis.cs
- Header.cs
- AssemblyName.cs
- StringUtil.cs
- DataGridTextBox.cs
- MemberJoinTreeNode.cs
- DesignParameter.cs
- ValidationPropertyAttribute.cs
- DefaultParameterValueAttribute.cs
- OleDbParameterCollection.cs
- ProxyWebPartConnectionCollection.cs