Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / MetaChildrenColumn.cs / 1305376 / MetaChildrenColumn.cs
using System.Security.Permissions; using System.Collections.Generic; using System.Diagnostics; using System.Web.DynamicData.ModelProviders; using System.Collections; using System.Web.Routing; namespace System.Web.DynamicData { ////// A special column representing 1-many relationships /// public class MetaChildrenColumn : MetaColumn, IMetaChildrenColumn { public MetaChildrenColumn(MetaTable table, ColumnProvider entityMember) : base(table, entityMember) { } ////// Perform initialization logic for this column /// internal protected override void Initialize() { base.Initialize(); AssociationProvider a = this.Provider.Association; ChildTable = Model.GetTable(a.ToTable.Name, Table.DataContextType); if (a.ToColumn != null) { ColumnInOtherTable = ChildTable.GetColumn(a.ToColumn.Name); } } ////// Returns whether this entity set column is in a Many To Many relationship /// public bool IsManyToMany { get { return Provider.Association != null && Provider.Association.Direction == AssociationDirection.ManyToMany; } } ////// The child table (e.g. Products in Categories<-Products) /// public MetaTable ChildTable { get; private set; } ////// A pointer to the MetaColumn in the other table /// public MetaColumn ColumnInOtherTable { get; private set; } ////// Override disabling sorting /// internal override string SortExpressionInternal { get { // children columns are not sortable return String.Empty; } } /*protected*/ internal override bool ScaffoldNoCache { get { // always display 1-many associations return true; } } ////// Shortcut for getting the path to the list action for all entities in the child table that have the given row as a parent. /// /// ///public string GetChildrenListPath(object row) { return GetChildrenPath(PageAction.List, row); } public string GetChildrenPath(string action, object row) { // If there is no row, we can't get a path if (row == null) return String.Empty; return ChildTable.GetActionPath(action, GetRouteValues(row)); } public string GetChildrenPath(string action, object row, string path) { // If there is no row, we can't get a path if (row == null) return String.Empty; if (String.IsNullOrEmpty(path)) { return GetChildrenPath(action, row); } // Build a query string param with our primary key RouteValueDictionary routeValues = GetRouteValues(row); // Add it to the path return QueryStringHandler.AddFiltersToPath(path, routeValues); } private RouteValueDictionary GetRouteValues(object row) { var routeValues = new RouteValueDictionary(); IList
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ElementNotEnabledException.cs
- XsltSettings.cs
- UnsafeNativeMethods.cs
- WebPartAddingEventArgs.cs
- _MultipleConnectAsync.cs
- EmptyEnumerator.cs
- FamilyTypefaceCollection.cs
- DataControlLinkButton.cs
- SQLSingleStorage.cs
- ApplicationInfo.cs
- MessageSecurityOverHttp.cs
- UpDownEvent.cs
- ParallelEnumerable.cs
- BrowserTree.cs
- WebSysDisplayNameAttribute.cs
- TableStyle.cs
- ReadOnlyKeyedCollection.cs
- TextServicesCompartmentContext.cs
- Attributes.cs
- DataColumnMappingCollection.cs
- XmlnsCache.cs
- TraceSwitch.cs
- NamedPermissionSet.cs
- FrameworkObject.cs
- Repeater.cs
- NoResizeHandleGlyph.cs
- XmlSchemaObject.cs
- TranslateTransform3D.cs
- DocumentPageViewAutomationPeer.cs
- FirstMatchCodeGroup.cs
- TextBoxBase.cs
- OwnerDrawPropertyBag.cs
- QueryableDataSourceView.cs
- UniqueIdentifierService.cs
- MemoryMappedViewAccessor.cs
- DefaultValueConverter.cs
- StoreContentChangedEventArgs.cs
- VisualStyleTypesAndProperties.cs
- CustomServiceCredentials.cs
- Columns.cs
- ImageInfo.cs
- ToolStripComboBox.cs
- Rotation3D.cs
- PolicyStatement.cs
- DataBindingCollection.cs
- CacheChildrenQuery.cs
- KeyValueInternalCollection.cs
- PeerCollaboration.cs
- TypeBuilderInstantiation.cs
- ValidationErrorCollection.cs
- SerialErrors.cs
- SQLMoneyStorage.cs
- Soap11ServerProtocol.cs
- ConnectionStringEditor.cs
- ProfilePropertySettings.cs
- SoapSchemaMember.cs
- HttpApplication.cs
- FrameworkContentElement.cs
- newitemfactory.cs
- AnonymousIdentificationSection.cs
- DataGridCell.cs
- CheckPair.cs
- DesignParameter.cs
- Signature.cs
- ToolStripGripRenderEventArgs.cs
- SoapDocumentMethodAttribute.cs
- WebBrowserUriTypeConverter.cs
- BuildProviderCollection.cs
- LateBoundBitmapDecoder.cs
- ConfigurationSettings.cs
- DataChangedEventManager.cs
- VScrollProperties.cs
- FontUnitConverter.cs
- HybridDictionary.cs
- FillRuleValidation.cs
- CompilationUtil.cs
- ImmutableCollection.cs
- SubpageParagraph.cs
- RetrieveVirtualItemEventArgs.cs
- StringBuilder.cs
- PropertyInfoSet.cs
- ClientScriptManager.cs
- XmlDocumentFragment.cs
- CultureTableRecord.cs
- ToolStripDropDownClosedEventArgs.cs
- SeverityFilter.cs
- _ScatterGatherBuffers.cs
- DirectionalLight.cs
- NetNamedPipeSecurityMode.cs
- ProjectionPlanCompiler.cs
- HtmlDocument.cs
- ManagedFilter.cs
- RIPEMD160Managed.cs
- SmiXetterAccessMap.cs
- FileSecurity.cs
- SQLInt16Storage.cs
- KnownColorTable.cs
- CaseKeyBox.ViewModel.cs
- UITypeEditor.cs
- Identity.cs