Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / Util / RouteParametersHelper.cs / 1305376 / RouteParametersHelper.cs
using System.Collections.Generic; using System.Diagnostics; using System.Web.UI.WebControls; namespace System.Web.DynamicData.Util { internal class RouteParametersHelper { private static Parameter CreateParameter(string name, string value, MetaColumn configurationColumn) { var param = new Parameter() { Name = name, DefaultValue = value }; DataSourceUtil.SetParameterTypeCodeAndDbType(param, configurationColumn); return param; } internal static IEnumerableGetColumnParameters(MetaTable table, string columnName) { if (String.IsNullOrEmpty(columnName)) { // If no column is specified, we're setting the primary key from the query string return GetPrimaryKeyParameters(table); } else { var column = table.GetColumn(columnName); var fkColumn = column as MetaForeignKeyColumn; if (fkColumn != null) { // Handle the case where we're setting one of our foreign keys from the query string return GetForeignKeyParameters(fkColumn); } else { // Handle other columns (e.g. booleans) return GetRegularColumnParameters(column); } } } internal static IEnumerable GetForeignKeyParameters(MetaForeignKeyColumn fkColumn) { Debug.Assert(fkColumn.ForeignKeyNames.Count == fkColumn.ParentTable.PrimaryKeyColumns.Count); var result = new List (); for (int i = 0; i < fkColumn.ForeignKeyNames.Count; i++) { string name = fkColumn.ForeignKeyNames[i]; string value = Misc.GetRouteValue(name); MetaColumn parentTablePKColumn = fkColumn.ParentTable.PrimaryKeyColumns[i]; var param = CreateParameter(name, value, parentTablePKColumn); result.Add(param); } return result; } internal static IEnumerable GetPrimaryKeyParameters(MetaTable table) { var result = new List (); foreach (var primaryKeyColumn in table.PrimaryKeyColumns) { string name = primaryKeyColumn.Name; string value = Misc.GetRouteValue(name); var param = CreateParameter(name, value, primaryKeyColumn); result.Add(param); } return result; } internal static IEnumerable GetRegularColumnParameters(MetaColumn column) { // Handle other columns (e.g. booleans) string name = column.Name; string value = Misc.GetRouteValue(name); var param = CreateParameter(name, value, column); return new List () { param }; } } } // 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
- WeakReferenceEnumerator.cs
- wmiprovider.cs
- RewritingSimplifier.cs
- UITypeEditors.cs
- DuplexSecurityProtocolFactory.cs
- WebPartVerbCollection.cs
- SmiXetterAccessMap.cs
- RoutedEventArgs.cs
- ProfileServiceManager.cs
- ProtocolsSection.cs
- ComponentManagerBroker.cs
- CombinedGeometry.cs
- TargetInvocationException.cs
- TextElementCollectionHelper.cs
- ProxyWebPart.cs
- MetabaseReader.cs
- WorkflowServiceInstance.cs
- Matrix3DConverter.cs
- SqlProcedureAttribute.cs
- ZipIOModeEnforcingStream.cs
- DrawingAttributesDefaultValueFactory.cs
- WindowsPrincipal.cs
- ProcessRequestAsyncResult.cs
- StandardToolWindows.cs
- MouseActionConverter.cs
- DashStyles.cs
- VersionedStream.cs
- xsdvalidator.cs
- FileVersion.cs
- UmAlQuraCalendar.cs
- BindingRestrictions.cs
- IgnoreSectionHandler.cs
- DbQueryCommandTree.cs
- ThemeDictionaryExtension.cs
- BinHexEncoder.cs
- DbProviderManifest.cs
- DecimalMinMaxAggregationOperator.cs
- RelationshipManager.cs
- AlgoModule.cs
- DiscoveryDocumentReference.cs
- PeerApplication.cs
- IsolatedStorage.cs
- ItemsPresenter.cs
- CipherData.cs
- CorrelationRequestContext.cs
- ClientSettingsSection.cs
- BookmarkCallbackWrapper.cs
- QuaternionAnimationUsingKeyFrames.cs
- PtsContext.cs
- XmlText.cs
- DocumentCollection.cs
- RegexMatchCollection.cs
- ScrollContentPresenter.cs
- SchemaImporter.cs
- SqlParameter.cs
- ControlIdConverter.cs
- CollectionBuilder.cs
- Peer.cs
- FileCodeGroup.cs
- TemplateApplicationHelper.cs
- GeneralTransform2DTo3D.cs
- AutomationIdentifierGuids.cs
- iisPickupDirectory.cs
- InvokeMethod.cs
- ThreadPool.cs
- XamlFilter.cs
- DynamicDiscoSearcher.cs
- DrawingAttributeSerializer.cs
- SortDescription.cs
- LateBoundBitmapDecoder.cs
- SiteMapHierarchicalDataSourceView.cs
- InheritanceAttribute.cs
- ProtocolsSection.cs
- WebPartEditorApplyVerb.cs
- LinkedList.cs
- TextSearch.cs
- ClientRolePrincipal.cs
- ExpressionDumper.cs
- Win32PrintDialog.cs
- DataSourceHelper.cs
- TimeSpanStorage.cs
- BufferBuilder.cs
- ListViewContainer.cs
- FontSource.cs
- MediaContextNotificationWindow.cs
- Size.cs
- ScrollChrome.cs
- SplitterEvent.cs
- EventMemberCodeDomSerializer.cs
- EtwTrace.cs
- MatrixAnimationUsingPath.cs
- Button.cs
- GraphicsPathIterator.cs
- TreeNodeSelectionProcessor.cs
- CrossContextChannel.cs
- DocumentViewerHelper.cs
- GridProviderWrapper.cs
- WebPartConnectionCollection.cs
- FlowNode.cs
- IssuedTokenClientCredential.cs