Code:
/ 4.0 / 4.0 / 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
- SQLRoleProvider.cs
- BitmapFrameDecode.cs
- UnlockInstanceAsyncResult.cs
- LogWriteRestartAreaAsyncResult.cs
- PictureBoxDesigner.cs
- CheckBoxList.cs
- DocumentPageView.cs
- MimeMapping.cs
- MemoryPressure.cs
- ExpressionBuilder.cs
- GcHandle.cs
- CurrentChangingEventManager.cs
- CodeExporter.cs
- MsmqActivation.cs
- TabControlCancelEvent.cs
- Restrictions.cs
- XmlCharacterData.cs
- FixedSOMSemanticBox.cs
- DataGridViewColumn.cs
- WMIInterop.cs
- RuleInfoComparer.cs
- EntityCommand.cs
- UriExt.cs
- SplitContainer.cs
- AdornerDecorator.cs
- TraceHwndHost.cs
- EventLogInformation.cs
- GPPOINT.cs
- TimeSpanStorage.cs
- DesignTimeType.cs
- CompilationUtil.cs
- UrlPath.cs
- MemoryFailPoint.cs
- DynamicMetaObject.cs
- MultiByteCodec.cs
- DataColumn.cs
- LocalizableResourceBuilder.cs
- SqlFlattener.cs
- SignatureDescription.cs
- GACMembershipCondition.cs
- ConvertTextFrag.cs
- SettingsPropertyValue.cs
- DataServiceQueryOfT.cs
- WebPartTransformerCollection.cs
- XmlNavigatorStack.cs
- RecommendedAsConfigurableAttribute.cs
- RouteTable.cs
- storepermission.cs
- GridViewPageEventArgs.cs
- Matrix3D.cs
- ServiceDesigner.cs
- Contracts.cs
- QueryOptionExpression.cs
- BaseValidator.cs
- CFStream.cs
- FragmentQuery.cs
- EdmPropertyAttribute.cs
- PenThreadPool.cs
- DataGridCellAutomationPeer.cs
- CdpEqualityComparer.cs
- TextChangedEventArgs.cs
- ContentType.cs
- HostExecutionContextManager.cs
- TreeViewDesigner.cs
- StorageConditionPropertyMapping.cs
- SyndicationDeserializer.cs
- JsonSerializer.cs
- DbParameterCollectionHelper.cs
- Invariant.cs
- TemplateManager.cs
- HttpProfileBase.cs
- DataGridItemEventArgs.cs
- FormConverter.cs
- sqlstateclientmanager.cs
- BasicExpressionVisitor.cs
- ObjectListSelectEventArgs.cs
- BindingWorker.cs
- Int32Storage.cs
- CodeEventReferenceExpression.cs
- DataGridViewDesigner.cs
- RIPEMD160Managed.cs
- RootBuilder.cs
- StringFormat.cs
- ChannelManager.cs
- InkCollectionBehavior.cs
- XmlHierarchicalEnumerable.cs
- UriParserTemplates.cs
- TcpClientSocketManager.cs
- ContextMenu.cs
- KnownTypesHelper.cs
- StrokeRenderer.cs
- HatchBrush.cs
- ExtentCqlBlock.cs
- RemotingServices.cs
- SystemIcons.cs
- DurableErrorHandler.cs
- DrawingImage.cs
- Documentation.cs
- CompressStream.cs
- ClrProviderManifest.cs