当前位置: 首页>>代码示例>>C#>>正文


C# INakedObject.GetAsQueryable方法代码示例

本文整理汇总了C#中INakedObject.GetAsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# INakedObject.GetAsQueryable方法的具体用法?C# INakedObject.GetAsQueryable怎么用?C# INakedObject.GetAsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INakedObject的用法示例。


在下文中一共展示了INakedObject.GetAsQueryable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FilterCollection

        internal INakedObject FilterCollection(INakedObject nakedObject, ObjectAndControlData controlData) {
            var form = controlData.Form;
            if (form != null && nakedObject != null && nakedObject.Specification.IsCollection && nakedObject.Oid is CollectionMemento) {
                nakedObject = Page(nakedObject, nakedObject.GetAsQueryable().Count(), controlData, false);
                var map = nakedObject.GetAsEnumerable().ToDictionary(FrameworkHelper.GetObjectId, y => y.Object);
                var selected = map.Where(kvp => form.Keys.Cast<string>().Contains(kvp.Key) && form[kvp.Key].Contains("true")).Select(kvp => kvp.Value).ToArray();
                return CloneAndPopulateCollection(nakedObject, selected, false);
            }

            return nakedObject;
        }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: AppropriateView

        internal ActionResult AppropriateView(ObjectAndControlData controlData, INakedObject nakedObject, INakedObjectAction action = null, string propertyName = null) {
            if (nakedObject == null) {
                // no object to go to 
                // if action on object go to that object. 
                // if action on collection go to collection 
                // if action on service go to last object 

                nakedObject = controlData.GetNakedObject();

                if (nakedObject.Specification.IsService) {
                    object lastObject = Session.LastObject(ObjectCache.ObjectFlag.BreadCrumb);
                    if (lastObject == null) {
                        TempData[IdHelper.NofMessages] = NakedObjectsContext.MessageBroker.Messages;
                        TempData[IdHelper.NofWarnings] = NakedObjectsContext.MessageBroker.Warnings;
                        return RedirectToAction(IdHelper.IndexAction, IdHelper.HomeName);
                    }

                    nakedObject = FrameworkHelper.GetNakedObject(lastObject);
                }
            }

            if (nakedObject.Specification.IsCollection && !nakedObject.Specification.IsParseable) {
                var collection = nakedObject.GetAsQueryable();
                int collectionSize = collection.Count();
                if (collectionSize == 1) {
                    // remove any paging data - to catch case where custom page has embedded standalone collection as paging data will confuse rendering 
                    ViewData.Remove(IdHelper.PagingData);
                    return View("ObjectView", collection.First());
                }

                nakedObject = Page(nakedObject, collectionSize, controlData, nakedObject.IsNotQueryable());
                action = action ?? ((CollectionMemento)nakedObject.Oid).Action;
                int page, pageSize;
                CurrentlyPaging(controlData, collectionSize, out page, out pageSize);
                var format = ViewData["NofCollectionFormat"] as string;
                return View("StandaloneTable", ActionResultModel.Create(action, nakedObject, page, pageSize, format));
            }
            // remove any paging data - to catch case where custom page has embedded standalone collection as paging data will confuse rendering   
            ViewData.Remove(IdHelper.PagingData);

            if (controlData.DataDict.Values.Contains("max")) {
                // maximizing an inline object - do not update history
                ViewData.Add("updateHistory", false);
            }

            return propertyName == null ? View(nakedObject.IsNotPersistent() ? "ObjectView" : "ViewNameSetAfterTransaction", nakedObject.Object) :
                                          View(nakedObject.IsNotPersistent() ? "PropertyView" : "ViewNameSetAfterTransaction", new PropertyViewModel(nakedObject.Object, propertyName));
        }
开发者ID:,项目名称:,代码行数:48,代码来源:


注:本文中的INakedObject.GetAsQueryable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。