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
- Events.cs
- RelationshipConverter.cs
- ImageList.cs
- DataObjectAttribute.cs
- PerfCounterSection.cs
- XmlDesignerDataSourceView.cs
- Ref.cs
- FixedSOMTextRun.cs
- ScaleTransform.cs
- ModelPropertyDescriptor.cs
- TokenBasedSet.cs
- ListView.cs
- SelectedGridItemChangedEvent.cs
- KeyManager.cs
- ItemCollection.cs
- DesignerInterfaces.cs
- Regex.cs
- NegotiationTokenAuthenticator.cs
- InfoCardClaim.cs
- CounterCreationDataCollection.cs
- CommandConverter.cs
- AuthenticateEventArgs.cs
- XmlSerializableReader.cs
- CacheForPrimitiveTypes.cs
- EdmFunction.cs
- Figure.cs
- DeviceContexts.cs
- ipaddressinformationcollection.cs
- AnnouncementDispatcherAsyncResult.cs
- RestHandlerFactory.cs
- CorrelationService.cs
- CallTemplateAction.cs
- SQLMembershipProvider.cs
- DrawingContextWalker.cs
- ApplicationDirectoryMembershipCondition.cs
- CheckoutException.cs
- HttpDigestClientElement.cs
- ModifiableIteratorCollection.cs
- ConstraintEnumerator.cs
- NonSerializedAttribute.cs
- XPathExpr.cs
- ScrollItemProviderWrapper.cs
- QueryStringConverter.cs
- PropertyMetadata.cs
- PersonalizableAttribute.cs
- XmlArrayItemAttribute.cs
- Profiler.cs
- FixUpCollection.cs
- CuspData.cs
- DataGridState.cs
- UnsafeNativeMethods.cs
- DataKeyCollection.cs
- WebServiceReceiveDesigner.cs
- GeometryGroup.cs
- XmlTextAttribute.cs
- PropertyMapper.cs
- BrowserInteropHelper.cs
- RNGCryptoServiceProvider.cs
- PackageRelationshipSelector.cs
- UnitySerializationHolder.cs
- XmlBindingWorker.cs
- RuntimeCompatibilityAttribute.cs
- XmlSerializerNamespaces.cs
- TypeSystemProvider.cs
- HttpHeaderCollection.cs
- GeometryValueSerializer.cs
- ObjectDataSourceView.cs
- DataColumn.cs
- RewritingProcessor.cs
- itemelement.cs
- ScopeElement.cs
- SqlStatistics.cs
- RemotingConfigParser.cs
- TimerElapsedEvenArgs.cs
- Int16AnimationUsingKeyFrames.cs
- COM2Properties.cs
- Page.cs
- EnterpriseServicesHelper.cs
- EntityWithChangeTrackerStrategy.cs
- DBBindings.cs
- COAUTHINFO.cs
- GeneralTransform3D.cs
- RuleSettings.cs
- DesignTimeHTMLTextWriter.cs
- BookmarkInfo.cs
- SqlDataAdapter.cs
- ByteFacetDescriptionElement.cs
- TextBoxAutoCompleteSourceConverter.cs
- PermissionSetEnumerator.cs
- DuplicateWaitObjectException.cs
- DataObjectFieldAttribute.cs
- IncrementalHitTester.cs
- CallTemplateAction.cs
- SpeechEvent.cs
- FontFamily.cs
- Vertex.cs
- AnnotationService.cs
- QuotedPrintableStream.cs
- ScaleTransform.cs
- ScrollProviderWrapper.cs