Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DLinq / Dlinq / SqlClient / Query / SqlTopReducer.cs / 1305376 / SqlTopReducer.cs
using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; using System.Data.Linq; using System.Data.Linq.Provider; using System.Linq; namespace System.Data.Linq.SqlClient { internal class SqlTopReducer { internal static SqlNode Reduce(SqlNode node, SqlNodeAnnotations annotations, SqlFactory sql) { return new Visitor(annotations, sql).Visit(node); } class Visitor : SqlVisitor { SqlNodeAnnotations annotations; SqlFactory sql; internal Visitor(SqlNodeAnnotations annotations, SqlFactory sql) { this.annotations = annotations; this.sql = sql; } internal override SqlSelect VisitSelect(SqlSelect select) { base.VisitSelect(select); if (select.Top != null) { if (select.Top.NodeType == SqlNodeType.Value) { SqlValue val = (SqlValue)select.Top; // convert to literal value for SQL2K compatibility if (val.IsClientSpecified) { select.Top = sql.Value(val.ClrType, val.SqlType, val.Value, false, val.SourceExpression); } } else { // cannot be converted to literal value. note that this select is not SQL2K compatible this.annotations.Add(select.Top, new SqlServerCompatibilityAnnotation(Strings.SourceExpressionAnnotation(select.Top.SourceExpression), SqlProvider.ProviderMode.Sql2000)); } } return select; } } } } // 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
- TypeSemantics.cs
- Win32PrintDialog.cs
- HandledMouseEvent.cs
- BindingCompleteEventArgs.cs
- ItemsControl.cs
- ProcessInfo.cs
- TypeForwardedToAttribute.cs
- RequestQueryParser.cs
- SecureStringHasher.cs
- FilterQuery.cs
- SplitContainerDesigner.cs
- BamlLocalizationDictionary.cs
- LocatorManager.cs
- OperationFormatter.cs
- ContainerUIElement3D.cs
- FillBehavior.cs
- ContractNamespaceAttribute.cs
- SqlNotificationEventArgs.cs
- MouseWheelEventArgs.cs
- CompositeControl.cs
- WhereQueryOperator.cs
- WebPartConnectVerb.cs
- counter.cs
- XmlUrlResolver.cs
- ActivityExecutionContextCollection.cs
- UInt16Storage.cs
- CodeGenerator.cs
- BezierSegment.cs
- EntityDataSourceChangingEventArgs.cs
- BinaryConverter.cs
- SafeFileMappingHandle.cs
- ToolStripPanelCell.cs
- WebPartDisplayModeEventArgs.cs
- ComponentCache.cs
- BindingExpressionUncommonField.cs
- ResourceWriter.cs
- KnownTypeHelper.cs
- PerformanceCounterPermissionEntryCollection.cs
- TextElementEditingBehaviorAttribute.cs
- HeaderedContentControl.cs
- StickyNoteAnnotations.cs
- TreeNodeBinding.cs
- FormsAuthenticationConfiguration.cs
- UnauthorizedWebPart.cs
- BamlTreeMap.cs
- ArraySubsetEnumerator.cs
- DictionaryBase.cs
- OleDbStruct.cs
- ConditionalWeakTable.cs
- VirtualPathProvider.cs
- IApplicationTrustManager.cs
- ResourceWriter.cs
- MessageAction.cs
- MultiView.cs
- DateTimeConverter.cs
- DriveInfo.cs
- CheckoutException.cs
- AttributeQuery.cs
- RoleGroupCollection.cs
- ArcSegment.cs
- SelectionProcessor.cs
- Merger.cs
- ImageListUtils.cs
- StateManagedCollection.cs
- Rect3D.cs
- ChildTable.cs
- TypeResolvingOptions.cs
- Stack.cs
- PagerStyle.cs
- GridProviderWrapper.cs
- GroupBox.cs
- InternalConfigConfigurationFactory.cs
- Utils.cs
- ObjectListCommandsPage.cs
- CommonRemoteMemoryBlock.cs
- ValidationHelper.cs
- StaticExtensionConverter.cs
- PageWrapper.cs
- ProfileBuildProvider.cs
- ExtendedProperty.cs
- PerformanceCounters.cs
- _WinHttpWebProxyDataBuilder.cs
- RegexTree.cs
- FlowDocumentPage.cs
- MessageQueueConverter.cs
- HybridObjectCache.cs
- HtmlControlPersistable.cs
- FactoryId.cs
- MemoryPressure.cs
- DescendantBaseQuery.cs
- VirtualDirectoryMapping.cs
- ThreadLocal.cs
- UpdatableGenericsFeature.cs
- NonBatchDirectoryCompiler.cs
- contentDescriptor.cs
- DBParameter.cs
- StringFreezingAttribute.cs
- CodeTypeDeclaration.cs
- XmlStreamStore.cs
- Camera.cs