Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DLinq / Dlinq / SqlClient / Common / SqlServer2KCompatibilityCheck.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LinqTreeNodeEvaluator.cs
- ProfilePropertyMetadata.cs
- SafeCryptoHandles.cs
- PropertyDescriptorGridEntry.cs
- MetadataItemCollectionFactory.cs
- HttpException.cs
- SectionInput.cs
- DataContract.cs
- InheritanceAttribute.cs
- _ChunkParse.cs
- RelationshipType.cs
- TextWriterTraceListener.cs
- BitmapScalingModeValidation.cs
- LoginView.cs
- TextModifier.cs
- BitmapSource.cs
- CLSCompliantAttribute.cs
- CustomDictionarySources.cs
- RawUIStateInputReport.cs
- HTMLTextWriter.cs
- TimeZone.cs
- MarkupCompiler.cs
- DirectionalLight.cs
- LayoutDump.cs
- Control.cs
- OneOfTypeConst.cs
- ManagementExtension.cs
- _SpnDictionary.cs
- RegexFCD.cs
- WebRequestModuleElement.cs
- CompositionTarget.cs
- OleDbParameter.cs
- ContentPosition.cs
- NetStream.cs
- BitmapDownload.cs
- ListChangedEventArgs.cs
- ExeConfigurationFileMap.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- BinaryObjectReader.cs
- EventLog.cs
- Point3DAnimation.cs
- TimeStampChecker.cs
- HuffmanTree.cs
- ClassHandlersStore.cs
- ListViewSortEventArgs.cs
- ToolBarButtonDesigner.cs
- Matrix3D.cs
- ThumbAutomationPeer.cs
- DropDownList.cs
- VerticalAlignConverter.cs
- SessionPageStateSection.cs
- EventDrivenDesigner.cs
- RawKeyboardInputReport.cs
- SqlFacetAttribute.cs
- BaseTemplatedMobileComponentEditor.cs
- ResourcesBuildProvider.cs
- WindowsRegion.cs
- Fx.cs
- AnnotationResourceChangedEventArgs.cs
- StrokeNodeOperations.cs
- ToolStripItemCollection.cs
- ZoneLinkButton.cs
- SignatureGenerator.cs
- AbsoluteQuery.cs
- InternalCache.cs
- DataServiceQuery.cs
- HttpCachePolicyElement.cs
- TableLayoutRowStyleCollection.cs
- ListViewTableRow.cs
- StagingAreaInputItem.cs
- ObjectSpanRewriter.cs
- ProtectedConfigurationSection.cs
- DataGridTable.cs
- HideDisabledControlAdapter.cs
- ElementUtil.cs
- SafeNativeMethods.cs
- OleDbPermission.cs
- HtmlEmptyTagControlBuilder.cs
- TimerElapsedEvenArgs.cs
- BrowserCapabilitiesFactoryBase.cs
- EditCommandColumn.cs
- ProxyHelper.cs
- WorkerRequest.cs
- XmlSequenceWriter.cs
- ApplicationManager.cs
- QuestionEventArgs.cs
- AssemblyName.cs
- CorruptingExceptionCommon.cs
- HttpCachePolicyElement.cs
- PriorityBinding.cs
- _ConnectOverlappedAsyncResult.cs
- CompilationPass2TaskInternal.cs
- ProofTokenCryptoHandle.cs
- ParallelTimeline.cs
- PropertyAccessVisitor.cs
- XsdCachingReader.cs
- ComplexTypeEmitter.cs
- Triangle.cs
- CodeDelegateCreateExpression.cs
- DictionaryGlobals.cs