Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DLinq / Dlinq / SqlClient / Query / SqlCrossApplyToCrossJoin.cs / 1305376 / SqlCrossApplyToCrossJoin.cs
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace System.Data.Linq.SqlClient { using System.Data.Linq; ////// Turn CROSS APPLY into CROSS JOIN when the right side /// of the apply doesn't reference anything on the left side. /// /// Any query which has a CROSS APPLY which cannot be converted to /// a CROSS JOIN is annotated so that we can give a meaningful /// error message later for SQL2K. /// internal class SqlCrossApplyToCrossJoin { internal static SqlNode Reduce(SqlNode node, SqlNodeAnnotations annotations) { Reducer r = new Reducer(); r.Annotations = annotations; return r.Visit(node); } class Reducer : SqlVisitor { internal SqlNodeAnnotations Annotations; internal override SqlSource VisitJoin(SqlJoin join) { if (join.JoinType == SqlJoinType.CrossApply) { // Look down the left side to see what table aliases are produced. HashSetp = SqlGatherProducedAliases.Gather(join.Left); // Look down the right side to see what table aliases are consumed. HashSet c = SqlGatherConsumedAliases.Gather(join.Right); // Look at each consumed alias and see if they are mentioned in produced. if (p.Overlaps(c)) { Annotations.Add(join, new SqlServerCompatibilityAnnotation(Strings.SourceExpressionAnnotation(join.SourceExpression), SqlProvider.ProviderMode.Sql2000)); // Can't reduce because this consumed alias is produced on the left. return base.VisitJoin(join); } // Can turn this into a CROSS JOIN join.JoinType = SqlJoinType.Cross; return VisitJoin(join); } return base.VisitJoin(join); } } } } // 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
- recordstatefactory.cs
- LinearKeyFrames.cs
- OracleDataReader.cs
- Decimal.cs
- Pointer.cs
- XmlSchemaParticle.cs
- DmlSqlGenerator.cs
- InstanceNotReadyException.cs
- URLString.cs
- AuthenticationModuleElementCollection.cs
- MultipleViewPatternIdentifiers.cs
- ExpandSegmentCollection.cs
- Light.cs
- MetadataException.cs
- X509UI.cs
- DataServiceClientException.cs
- ConfigurationFileMap.cs
- ConfigurationValidatorAttribute.cs
- DecoderFallback.cs
- NumericUpDownAccelerationCollection.cs
- Lasso.cs
- IPGlobalProperties.cs
- StaticSiteMapProvider.cs
- ReaderWriterLock.cs
- VirtualDirectoryMappingCollection.cs
- PropertyMapper.cs
- HtmlMeta.cs
- WebDescriptionAttribute.cs
- Style.cs
- ScaleTransform.cs
- BaseParagraph.cs
- AddInPipelineAttributes.cs
- SemanticResolver.cs
- CompatibleComparer.cs
- FilteredDataSetHelper.cs
- ToolStripHighContrastRenderer.cs
- WebControl.cs
- TableRow.cs
- Activator.cs
- DesignerAutoFormatStyle.cs
- XmlSchemaComplexType.cs
- DataMemberAttribute.cs
- ExceptionUtil.cs
- KeyValueConfigurationCollection.cs
- PropertyDescriptor.cs
- ChameleonKey.cs
- HttpCookiesSection.cs
- SessionMode.cs
- ServiceRouteHandler.cs
- GenerateScriptTypeAttribute.cs
- GlobalId.cs
- HMACSHA256.cs
- PriorityItem.cs
- PathFigure.cs
- TextEditorLists.cs
- DisplayMemberTemplateSelector.cs
- BuildProviderAppliesToAttribute.cs
- FrameworkContentElement.cs
- PreviewPrintController.cs
- unitconverter.cs
- DependencyPropertyKind.cs
- XsdBuilder.cs
- ReflectionUtil.cs
- OdbcConnectionString.cs
- TcpHostedTransportConfiguration.cs
- HttpCacheParams.cs
- TargetFrameworkAttribute.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- MatrixAnimationUsingPath.cs
- ApplicationSecurityInfo.cs
- DataGridViewImageCell.cs
- AncillaryOps.cs
- CallContext.cs
- XmlQueryOutput.cs
- SimpleApplicationHost.cs
- DoubleLinkList.cs
- RoleGroup.cs
- UnsafeNativeMethods.cs
- DataGridClipboardCellContent.cs
- PositiveTimeSpanValidator.cs
- SystemInformation.cs
- GroupBoxDesigner.cs
- TrustLevel.cs
- TypeDescriptor.cs
- StylusCollection.cs
- WinCategoryAttribute.cs
- ToolStripCollectionEditor.cs
- RoutedEvent.cs
- TypeConverterHelper.cs
- Marshal.cs
- QilSortKey.cs
- ScriptControlManager.cs
- HttpClientChannel.cs
- MethodBuilderInstantiation.cs
- AttributeCollection.cs
- Scene3D.cs
- SearchForVirtualItemEventArgs.cs
- Padding.cs
- HitTestWithGeometryDrawingContextWalker.cs
- SettingsSection.cs