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


C# IContent.GetOriginalType方法代码示例

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


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

示例1: Delete

 public IDeleteResponse Delete(IContent content)
 {
     try {
         var deleteResponse = Client.Delete(content, x => x.Index(IndexResolver.GetIndex()));
         if (deleteResponse.IsValid == false) throw new DeleteException {DeleteResponse = deleteResponse };
         Logger.WriteToLog($"Deleted content Name={content.Name} Id={content.ContentLink.ID} Type={content.GetOriginalType().Name} Elasticsearch response: Found={deleteResponse.Found} Id={deleteResponse.Id} Type={deleteResponse.Type}");
         return deleteResponse;
     }
     catch (DeleteException exception) {
         Logger.WriteToLog($"Delete content failed: Name={content.Name} Id={content.ContentLink.ID} Type={content.GetOriginalType().Name} Elasticsearch: Error={exception.DeleteResponse.ServerError.Error}",Level.Error);
     }
     catch (Exception exception)
     {
         Logger.WriteToLog("Unknown exception occured during delete indexing of content", Level.Error, exception);
     }
     return null;
 }
开发者ID:kneeclass,项目名称:ElasticEPi,代码行数:17,代码来源:ContentIndexer.cs

示例2: Convert

 public static string Convert(IContent content)
 {
     var properties = content.GetOriginalType()
            .GetProperties(BindingFlags.Public |
                           BindingFlags.Instance |
                           BindingFlags.DeclaredOnly);
     var list = new List<string>();
     foreach (var property in properties) {
         if(property.GetCustomAttribute(typeof (ElasticEPiIgnoreAttribute)) != null) continue;
         var value = property.GetValue(content) as string;
         if (!string.IsNullOrWhiteSpace(value))
             list.Add(value);
     }
     return string.Join(" ", list);
 }
开发者ID:kneeclass,项目名称:ElasticEPi,代码行数:15,代码来源:BlocksConverter.cs

示例3: Index

        public IIndexResponse Index(IContent content)
        {
            try {
                var response = Client.Index(content, x => x.
                    Index(IndexResolver.GetIndex()).
                    Id(content.ContentLink.ID)
                );
                var onIndexed = content as IOnIndexed;
                if(onIndexed != null) onIndexed.OnIndexed();

                if (response.IsValid == false) throw new IndexException {
                    ServerError = response.ServerError,
                    RequestInformation = response.RequestInformation
                };
                Logger.WriteToLog($"Indexed content: Name={content.Name} Id={content.ContentLink.ID} Type={content.GetOriginalType().Name}. Elasticsearch response: Created={response.Created} Version={response.Version} Id={response.Id} Type={response.Type}");
                return response;
            }
            catch (IndexException exception) {
                Logger.WriteToLog($"Indexing content failed: Name={content.Name} Id={content.ContentLink.ID} Type={content.GetOriginalType().Name} Exception details: Request={Encoding.UTF8.GetString(exception.RequestInformation.Request)} Response={Encoding.UTF8.GetString(exception.RequestInformation.ResponseRaw)}"  ,Level.Error,exception);
            }
            catch (Exception exception) {
                Logger.WriteToLog("Unknown exception occured during indexing of content", Level.Error, exception);
            }
            return null;
        }
开发者ID:kneeclass,项目名称:ElasticEPi,代码行数:25,代码来源:ContentIndexer.cs

示例4: GetTypeSpecificCssClasses

        private static string GetTypeSpecificCssClasses(IContent content)
        {
            var cssClass = content == null ? String.Empty : content.GetOriginalType().Name.ToLowerInvariant();

            var customClassContent = content as ICustomCssInContentArea;
            if (customClassContent != null && !string.IsNullOrWhiteSpace(customClassContent.ContentAreaCssClass))
            {
                cssClass += string.Format("{0}", customClassContent.ContentAreaCssClass);
            }
            return cssClass;
        }
开发者ID:smchristenson,项目名称:CommerceStarterKit,代码行数:11,代码来源:ContentAreaWithDefaultsRenderer.cs


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