• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IContent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IContent的典型用法代码示例。如果您正苦于以下问题:C# IContent类的具体用法?C# IContent怎么用?C# IContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IContent类属于命名空间,在下文中一共展示了IContent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PagesController

 /// <summary>
 /// Initializes a new instance of the <b>PagesController</b> class.
 /// </summary>
 /// <param name="structureInfo">The structure info.</param>
 /// <param name="currentPage">The current page.</param>
 /// <param name="session">The session.</param>
 /// <param name="content">The content.</param>
 public PagesController(IStructureInfo structureInfo, IPageModel currentPage, IDocumentSession session, IContent content)
 {
     _structureInfo = structureInfo;
     _currentPage = currentPage;
     _session = session;
     _content = content;
 }
开发者ID:bbqchickenrobot,项目名称:brickpile,代码行数:14,代码来源:PagesController.cs


示例2: UmbracoDataMappingContext

 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoDataMappingContext"/> class.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 public UmbracoDataMappingContext(object obj, IContent content, IUmbracoService service, bool publishedOnly)
     : base(obj)
 {
     Content = content;
     Service = service;
     PublishedOnly = publishedOnly;
 }
开发者ID:JamesHay,项目名称:Glass.Mapper,代码行数:13,代码来源:UmbracoDataMappingContext.cs


示例3: ListImpulses

        public IEnumerable<IImpulse> ListImpulses(IContent content, string displayType, object data = null)
        {
            var impulses = new List<ImpulseDisplayContext>();
            foreach (var impulse in GetDescriptors().Values) {

                if (!CheckDescriptor(impulse, content, data)) {
                    continue;
                }
                int? versionId = null;
                if (content.ContentItem.VersionRecord != null) versionId = content.ContentItem.VersionRecord.Id;
                var display = new ImpulseDisplayContext(impulse) {
                    Content = content,
                    DisplayType = displayType,
                    Data = data,
                    HrefRoute = new RouteValueDictionary(new {
                        action = "Actuate",
                        controller = "Impulse",
                        area = "Downplay.Mechanics",
                        name = impulse.Name,
                        returnUrl = Services.WorkContext.HttpContext.Request.RawUrl,
                        contentId = content.Id,
                        contentVersionId = versionId
                    })
                };
                                
                foreach (var e in impulse.DisplayingHandlers) {
                    e(display);
                }
                impulses.Add(display);

            }
            return impulses;
        }
开发者ID:akhurst,项目名称:ricealumni,代码行数:33,代码来源:ImpulseService.cs


示例4: Serialise

        public RuntimeContentModel Serialise(IContent content)
        {
            var publishedContent = _umbracoHelper.TypedContent(content.Id);

            if (publishedContent == null)
                return null;     

            var runtimeContent = Mapper.Map<RuntimeContentModel>(publishedContent);

            runtimeContent.Url = RemovePortFromUrl(publishedContent.UrlWithDomain());
            runtimeContent.RelativeUrl = publishedContent.Url;
            runtimeContent.CacheTime = null;

            runtimeContent.Type = publishedContent.DocumentTypeAlias;

            runtimeContent.Template = publishedContent.GetTemplateAlias();

            runtimeContent.Content = new Dictionary<string, object>();

            foreach (var property in content.Properties)
            {
                if (!runtimeContent.Content.ContainsKey(property.Alias))
                    runtimeContent.Content.Add(property.Alias, property.Value);
            }

            foreach (var contentParser in _contentParsers)
            {
                runtimeContent = contentParser.ParseContent(runtimeContent);
            }
            
            RuntimeContext.Instance.ContentService.AddContent(runtimeContent);
            return runtimeContent;
        }
开发者ID:iahdevelop,项目名称:moriyama-umbraco-runtime,代码行数:33,代码来源:UmbracoContentSerialiser.cs


示例5: Write

        public Task Write(IContent content, Stream outputStream)
        {
            if (content.Model != null)
            {
                var enumerable = content.Model as IEnumerable<object>;
                if (enumerable != null)
                {
                    WriteList(outputStream, enumerable);
                }
                else
                {
                    var links = content.Links.ToList();
                    if (links.Count == 0)
                    {
                        new DataContractSerializer(content.Model.GetType()).WriteObject(outputStream, content.Model);
                    }
                    else
                    {
                        WriteWithLinks(content, outputStream, links);
                    }
                }
            }

            return TaskHelper.Completed();
        }
开发者ID:samsalisbury,项目名称:Simple.Web,代码行数:25,代码来源:XmlMediaTypeHandler.cs


示例6: ItemInspector

 public ItemInspector(IContent item, ContentItemMetadata metadata) {
     _item = item;
     _metadata = metadata;
     _common = item.Get<ICommonAspect>();
     _routable = item.Get<RoutableAspect>();
     _body = item.Get<BodyAspect>();
 }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:7,代码来源:ItemInspector.cs


示例7: Slugify

 public string Slugify(IContent content)
 {
     var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
     if (metadata == null) return null;
     var title = metadata.DisplayText.Trim();
     return Slugify(new FillSlugContext(content,title));
 }
开发者ID:Log-of-e,项目名称:orchard_cms_view_code,代码行数:7,代码来源:DefaultSlugService.cs


示例8:

        void ILocalizationService.SetContentCulture(IContent content, string culture) {
            var localized = content.As<LocalizationPart>();
            if (localized == null || localized.MasterContentItem == null)
                return;

            localized.Culture = _cultureManager.GetCultureByName(culture);
        }
开发者ID:sjbisch,项目名称:Orchard,代码行数:7,代码来源:LocalizationService.cs


示例9: GenerateXml

        /// <summary>
        /// The generate xml.
        /// </summary>
        /// <param name="page">
        /// The page.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GenerateXml(IContent page)
        {
            if (page == null)
            {
                return string.Empty;
            }

            XDocument xDocument = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), new object[0]);

            XElement xElement = new XElement("content");
            xElement.SetAttributeValue("name", XmlConvert.EncodeName(page.Name));

            List<KeyValuePair<string, string>> propertyValues = page.GetPropertyValues();

            foreach (KeyValuePair<string, string> content in propertyValues)
            {
                XElement xElement3 = new XElement(XmlConvert.EncodeName(content.Key));
                xElement3.SetValue(TextIndexer.StripHtml(content.Value, content.Value.Length));
                xElement.Add(xElement3);
            }

            xDocument.Add(xElement);

            return xDocument.ToString();
        }
开发者ID:jstemerdink,项目名称:EPiServer.Libraries,代码行数:34,代码来源:XmlOutputFormat.cs


示例10: ContentValueChangedActionItem

 /// <summary>
 /// Initializes a new instance of the <see cref="ContentValueChangedActionItem"/> class.
 /// </summary>
 /// <param name="name">The name of this action item.</param>
 /// <param name="content">The <see cref="IContent"/> instance that has changed.</param>
 /// <param name="index">The index of the change if the change occurred on an item of a collection. <c>null</c> otherwise.</param>
 /// <param name="previousValue">The previous value of the content (or the item if the change occurred on an item of a collection).</param>
 /// <param name="dirtiables">The dirtiable objects associated to this action item.</param>
 public ContentValueChangedActionItem(string name, IContent content, object index, object previousValue, IEnumerable<IDirtiable> dirtiables)
     : base(name, dirtiables)
 {
     this.Content = content;
     PreviousValue = previousValue;
     Index = index;
 }
开发者ID:FERRERDEV,项目名称:xenko,代码行数:15,代码来源:ContentValueChangedActionItem.cs


示例11: SetupViewModel

        public void SetupViewModel(FrontendContext frontendContext, IContent node, NodeViewModel viewModel)
        {
            if (node.ContentItem.ContentType != "WikipediaPage") return;

            viewModel.name = node.As<ITitleAspect>().Title;
            viewModel.data["url"] = node.As<WikipediaPagePart>().Url;
        }
开发者ID:Lombiq,项目名称:Associativy-Wikipedia-Instance,代码行数:7,代码来源:JitConfigurationHandler.cs


示例12: GenerateJson

        /// <summary>
        /// Generate the json output for the page.
        /// </summary>
        /// <param name="page">
        /// The page.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GenerateJson(IContent page)
        {
            string json;

            List<KeyValuePair<string, string>> propertyValues = page.GetPropertyValues();

            StringBuilder stringBuilder = new StringBuilder();

            using (StringWriter sw = new StringWriter(stringBuilder, CultureInfo.InvariantCulture))
            {
                JsonWriter jsonWriter = new JsonTextWriter(sw) { Formatting = Formatting.Indented };

                jsonWriter.WriteStartObject();

                jsonWriter.WritePropertyName(page.Name);

                jsonWriter.WriteStartObject();

                foreach (KeyValuePair<string, string> content in propertyValues)
                {
                    jsonWriter.WritePropertyName(content.Key);
                    jsonWriter.WriteValue(TextIndexer.StripHtml(content.Value, content.Value.Length));
                }

                jsonWriter.WriteEndObject();

                jsonWriter.WriteEndObject();

                json = sw.ToString();
            }

            return json;
        }
开发者ID:jstemerdink,项目名称:EPiServer.Libraries,代码行数:42,代码来源:JsonOutputFormat.cs


示例13: UpdateEditorContext

 public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, string groupInfoId, IShapeFactory shapeFactory, ShapeTable shapeTable, string path)
     : base(model, content, groupInfoId, shapeFactory) {
     
     ShapeTable = shapeTable;
     Updater = updater;
     Path = path;
 }
开发者ID:anycall,项目名称:Orchard,代码行数:7,代码来源:UpdateEditorContext.cs


示例14: GetMarkup

        /// <summary>
        /// Gets the markup for the tag based upon the passed in parameters.
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public override string GetMarkup(IContent currentPage, IDictionary<string, string> parameters)
        {
            var email = parameters["email"];
            var text = email;

            if (parameters.ContainsKey("subject"))
                email += ((email.IndexOf("?", StringComparison.InvariantCulture) == -1) ? "?" : "&") + "subject=" + parameters["subject"];

            if (parameters.ContainsKey("body"))
                email += ((email.IndexOf("?", StringComparison.InvariantCulture) == -1) ? "?" : "&") + "body=" + parameters["body"];

            var sb = new StringBuilder();
            sb.AppendFormat("<a href=\"mailto:{0}\"", email); // TODO: HTML encode

            if (parameters.ContainsKey("title"))
                sb.AppendFormat(" title=\"{0}\"", parameters["title"]);

            if (parameters.ContainsKey("class"))
                sb.AppendFormat(" class=\"{0}\"", parameters["class"]);

            sb.Append(">");
            sb.Append(parameters.ContainsKey("text")
                ? parameters["text"]
                : text);

            sb.Append("</a>");

            return sb.ToString();
        }
开发者ID:TSalaam,项目名称:karbon-cms,代码行数:35,代码来源:EmailTag.cs


示例15: ExecuteSync

 protected override void ExecuteSync(IContent content, Index index, object parameter)
 {
     var value = content.Retrieve(index);
     var collectionDescriptor = (CollectionDescriptor)TypeDescriptorFactory.Default.Find(value.GetType());
     object itemToAdd = null;
     // TODO: Find a better solution for ContentSerializerAttribute that doesn't require to reference Core.Serialization (and unreference this assembly)
     if (collectionDescriptor.ElementType.IsAbstract || collectionDescriptor.ElementType.IsNullable() || collectionDescriptor.ElementType.GetCustomAttributes(typeof(ContentSerializerAttribute), true).Any())
     {
         // If the parameter is a type instead of an instance, try to construct an instance of this type
         var type = parameter as Type;
         if (type?.GetConstructor(Type.EmptyTypes) != null)
             itemToAdd = Activator.CreateInstance(type);
     }
     else if (collectionDescriptor.ElementType == typeof(string))
     {
         itemToAdd = parameter ?? "";
     }
     else
     {
         itemToAdd = parameter ?? ObjectFactory.NewInstance(collectionDescriptor.ElementType);
     }
     if (index.IsEmpty)
     {
         content.Add(itemToAdd);
     }
     else
     {
         // Handle collections in collections
         // TODO: this is not working on the observable node side
         var collectionNode = content.Reference.AsEnumerable[index].TargetNode;
         collectionNode.Content.Add(itemToAdd);
     }
 }
开发者ID:cg123,项目名称:xenko,代码行数:33,代码来源:AddNewItemCommand.cs


示例16: BuildShapeContext

 protected BuildShapeContext(IShape shape, IContent content, string groupId, IShapeFactory shapeFactory) {
     Shape = shape;
     ContentItem = content.ContentItem;
     New = shapeFactory;
     GroupId = groupId;
     FindPlacement = (partType, differentiator, defaultLocation) => new PlacementInfo {Location = defaultLocation, Source = String.Empty};
 }
开发者ID:juaqaai,项目名称:CompanyGroup,代码行数:7,代码来源:BuildShapeContext.cs


示例17: Write

        public Task Write(IContent content, Stream outputStream)
        {
            if (content.Model != null)
            {
                object output;

                var enumerable = content.Model as IEnumerable<object>;
                if (enumerable != null)
                {
                    output = ProcessList(enumerable);
                }
                else
                {
                    output = ProcessContent(content);
                }
                byte[] buffer;
                using (var writer = new StringWriter())
                {
                    new JsonWriter().Write(output, writer);
                    buffer = Encoding.Default.GetBytes(writer.ToString());
                }
                return outputStream.WriteAsync(buffer, 0, buffer.Length);
            }

            return TaskHelper.Completed();
        }
开发者ID:vandenbergjp,项目名称:Simple.Web,代码行数:26,代码来源:JsonMediaTypeHandler.cs


示例18: ProcessContent

        private static JObject ProcessContent(IContent content, JsonSerializer serializer)
        {
            var links = content.Links.ToList();

            JObject jo;

            var list = content.Model as IEnumerable;
            if (list != null)
            {
                jo = new JObject();
                var array = new JArray();
                jo["collection"] = array;
                foreach (var o in list)
                {
                    var jitem = JObject.FromObject(o, serializer);
                    jitem.Add("_links", CreateHalLinks(LinkHelper.GetLinksForModel(o), serializer));
                    array.Add(jitem);
                }
            }
            else
            {
                jo = JObject.FromObject(content.Model, serializer);
            }

            if (links.Count > 0)
            {
                jo["_links"] = CreateHalLinks(links, serializer);
            }
            return jo;
        }
开发者ID:nordbergm,项目名称:Simple.Web,代码行数:30,代码来源:HalJsonMediaTypeHandler.cs


示例19: SetupModel

 protected virtual void SetupModel(FilterOptionFormModel model, string q, string sort, string facets, IContent content)
 {
     EnsurePage(model);
     EnsureQ(model, q);
     EnsureSort(model, sort);
     EnsureFacets(model, facets, content);
 }
开发者ID:ocrenaka,项目名称:Quicksilver,代码行数:7,代码来源:FilterOptionFormModelBinder.cs


示例20: CreateSyndicationItem

        private SyndicationItem CreateSyndicationItem(IContent content)
        {
            var changeTrackable = content as IChangeTrackable;
            var changed = DateTime.Now;
            var changedby = string.Empty;

            if (changeTrackable != null)
            {
                changed = changeTrackable.Saved;
                changedby = changeTrackable.ChangedBy;
            }

            var item = new SyndicationItem
            {
                Title = new TextSyndicationContent(content.Name),
                Summary = new TextSyndicationContent(FeedDescriptionProvider.ItemDescripton(content)),
                PublishDate = changed,
            };

            foreach (var contentCategory in ContentCategoryLoader.GetContentCategories(content))
            {
                item.Categories.Add(new SyndicationCategory(contentCategory));
            }         

            var mimeType = GetMimeType(content);
            Uri url = GetItemUrl(content);

            item.Content = new UrlSyndicationContent(url, mimeType);
            item.AddPermalink(url);
            item.Authors.Add(new SyndicationPerson(string.Empty, changedby, string.Empty));

            return item;
        }
开发者ID:pappabj0rn,项目名称:Chief2moro.SyndicationFeeds,代码行数:33,代码来源:SyndicationItemFactory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IContentDefinitionManager类代码示例发布时间:2022-05-24
下一篇:
C# IContainerOwner类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap