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
- Line.cs
- IpcClientChannel.cs
- NameSpaceExtractor.cs
- ByteConverter.cs
- Win32MouseDevice.cs
- AxHost.cs
- WindowsContainer.cs
- XmlCharacterData.cs
- DocumentSequence.cs
- EntryWrittenEventArgs.cs
- DbCommandTree.cs
- KeyConstraint.cs
- HitTestWithGeometryDrawingContextWalker.cs
- SystemKeyConverter.cs
- JsonFormatReaderGenerator.cs
- LogWriteRestartAreaState.cs
- Light.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- BindingContext.cs
- _UncName.cs
- WebPartZoneCollection.cs
- Vector3DKeyFrameCollection.cs
- CommandBindingCollection.cs
- SingleConverter.cs
- PlanCompiler.cs
- ListViewContainer.cs
- ColumnMapTranslator.cs
- CodeEntryPointMethod.cs
- FormViewAutoFormat.cs
- PopupRoot.cs
- ConfigurationElementCollection.cs
- assemblycache.cs
- ConfigurationPropertyAttribute.cs
- SQLResource.cs
- RequestStatusBarUpdateEventArgs.cs
- XmlElementList.cs
- WSFederationHttpSecurityElement.cs
- EntityRecordInfo.cs
- SerializationAttributes.cs
- XmlException.cs
- HttpHandlerActionCollection.cs
- FileCodeGroup.cs
- SingleAnimation.cs
- KnownBoxes.cs
- FlowNode.cs
- ClassValidator.cs
- ResourceReader.cs
- NoneExcludedImageIndexConverter.cs
- propertytag.cs
- HostingEnvironmentException.cs
- ScrollContentPresenter.cs
- Perspective.cs
- VirtualDirectoryMapping.cs
- IncrementalCompileAnalyzer.cs
- XPathChildIterator.cs
- DebuggerAttributes.cs
- SqlXml.cs
- Documentation.cs
- SchemaCollectionCompiler.cs
- ConfigXmlComment.cs
- SubqueryRules.cs
- DesignerSerializerAttribute.cs
- SynchronousReceiveBehavior.cs
- ScaleTransform.cs
- Point4DConverter.cs
- DataGridAutoFormat.cs
- Color.cs
- SoapConverter.cs
- OneWayBindingElementImporter.cs
- Visual3D.cs
- WebHttpDispatchOperationSelector.cs
- PrimarySelectionAdorner.cs
- ProgramPublisher.cs
- Version.cs
- SplitterCancelEvent.cs
- EntityProviderServices.cs
- Serializer.cs
- DockAndAnchorLayout.cs
- ProtectedConfiguration.cs
- EntityViewGenerationAttribute.cs
- HandlerFactoryCache.cs
- StreamInfo.cs
- DoubleLink.cs
- DataGridViewCheckBoxColumn.cs
- RoleService.cs
- RequiredFieldValidator.cs
- PathFigureCollectionValueSerializer.cs
- Propagator.ExtentPlaceholderCreator.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- ValidationSummary.cs
- DecimalAnimationBase.cs
- ContainsRowNumberChecker.cs
- TypeResolver.cs
- WebHeaderCollection.cs
- DataListItemCollection.cs
- WorkflowViewService.cs
- Label.cs
- PassportAuthentication.cs
- UICuesEvent.cs
- LambdaCompiler.Address.cs