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
- DbDeleteCommandTree.cs
- ClockController.cs
- EnumerableRowCollection.cs
- ProcessModuleCollection.cs
- selecteditemcollection.cs
- KeyValueInternalCollection.cs
- ErrorRuntimeConfig.cs
- GridViewCellAutomationPeer.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- ObjectStateFormatter.cs
- EmbossBitmapEffect.cs
- ValidatorCompatibilityHelper.cs
- BitmapCodecInfo.cs
- DispatchProxy.cs
- DataSourceControl.cs
- XmlSchemaInferenceException.cs
- CaseInsensitiveOrdinalStringComparer.cs
- DiscoveryMessageSequence11.cs
- Enumerable.cs
- ManagedWndProcTracker.cs
- WinCategoryAttribute.cs
- ProxyHelper.cs
- SafeLibraryHandle.cs
- XhtmlBasicListAdapter.cs
- CatalogPart.cs
- HTTPNotFoundHandler.cs
- ToolStripItemBehavior.cs
- SafeBitVector32.cs
- _UriTypeConverter.cs
- TriState.cs
- PreviousTrackingServiceAttribute.cs
- Rect.cs
- CodeTypeReferenceCollection.cs
- SQLResource.cs
- WorkflowPersistenceService.cs
- ComponentChangingEvent.cs
- ButtonStandardAdapter.cs
- TileModeValidation.cs
- HtmlShim.cs
- HwndMouseInputProvider.cs
- ByteAnimationUsingKeyFrames.cs
- ActivationServices.cs
- PropertyGridDesigner.cs
- UICuesEvent.cs
- CodeDirectoryCompiler.cs
- XPathExpr.cs
- TextEffectResolver.cs
- OpenTypeCommon.cs
- PersonalizationStateQuery.cs
- SiteMapDataSourceView.cs
- BindingOperations.cs
- PasswordRecovery.cs
- AttributeAction.cs
- NavigationWindow.cs
- CompiledQuery.cs
- MULTI_QI.cs
- WinFormsUtils.cs
- StrokeCollection.cs
- DataGridTextBoxColumn.cs
- WindowsListViewGroup.cs
- FormViewUpdatedEventArgs.cs
- InputLanguageManager.cs
- TextEditorTables.cs
- StringBlob.cs
- TypeLoadException.cs
- WindowsHyperlink.cs
- FixedNode.cs
- DependencyObjectPropertyDescriptor.cs
- TaskForm.cs
- SqlDataSource.cs
- CodeAccessPermission.cs
- RotateTransform3D.cs
- SessionState.cs
- CallTemplateAction.cs
- PropertyTabAttribute.cs
- EmptyCollection.cs
- MaterializeFromAtom.cs
- SoapCodeExporter.cs
- HttpStaticObjectsCollectionWrapper.cs
- SharedDp.cs
- ParallelRangeManager.cs
- ExpressionConverter.cs
- AssociationSet.cs
- PrivilegedConfigurationManager.cs
- HttpApplication.cs
- HttpListenerResponse.cs
- EventHandlerList.cs
- DataContractSerializerMessageContractImporter.cs
- EventLogEntryCollection.cs
- XamlReaderHelper.cs
- IntegerFacetDescriptionElement.cs
- SimpleHandlerFactory.cs
- XmlDataLoader.cs
- TreeNodeSelectionProcessor.cs
- RefType.cs
- PersonalizationProviderHelper.cs
- SqlDelegatedTransaction.cs
- EditorOptionAttribute.cs
- PersistencePipeline.cs
- WindowsListBox.cs