本文整理汇总了C#中Kooboo.CMS.Content.Models.TextContent类的典型用法代码示例。如果您正苦于以下问题:C# TextContent类的具体用法?C# TextContent怎么用?C# TextContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextContent类属于Kooboo.CMS.Content.Models命名空间,在下文中一共展示了TextContent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestWritePerformance
public void TestWritePerformance()
{
int count = 100000;
Stopwatch classStopwatch = new Stopwatch();
classStopwatch.Start();
for (int i = 0; i < count; i++)
{
dynamic content = new ContentObject();
content.UUID = Guid.NewGuid().ToString();
content.UserKey = "userkey";
}
classStopwatch.Stop();
Stopwatch dynamicStopwatch = new Stopwatch();
dynamicStopwatch.Start();
for (int i = 0; i < count; i++)
{
dynamic content = new TextContent();
content.UUID = Guid.NewGuid().ToString();
content.UserKey = "userkey";
}
dynamicStopwatch.Stop();
Console.WriteLine("class write:{0}ms", classStopwatch.ElapsedMilliseconds);
Console.WriteLine("dynamic object write:{0}ms", dynamicStopwatch.ElapsedMilliseconds);
}
开发者ID:Epitomy,项目名称:CMS,代码行数:28,代码来源:ContentModelPerformanceTests.cs
示例2: Execute
public override object Execute()
{
IEnumerable<TextContent> contents = new TextContent[0];
contents = TextContentQuery.Schema.GetContents();
if (TextContentQuery.Folder != null)
{
contents = contents.Where(it => it.FolderName.EqualsOrNullEmpty(TextContentQuery.Folder.FullName, StringComparison.CurrentCultureIgnoreCase));
}
QueryExpressionTranslator translator = new QueryExpressionTranslator();
var contentQueryable = translator.Translate(TextContentQuery.Expression, contents.AsQueryable());
foreach (var categoryQuery in translator.CategoryQueries)
{
var categories = (IEnumerable<TextContent>)ContentQueryExecutor.Execute(categoryQuery);
var categoryData = TextContentQuery.Repository.GetCategoryData()
.Where(it => categories.Any(c => it.CategoryUUID.EqualsOrNullEmpty(c.UUID, StringComparison.CurrentCultureIgnoreCase)));
contentQueryable = contentQueryable.Where(it => categoryData.Any(c => it.UUID.EqualsOrNullEmpty(c.ContentUUID, StringComparison.CurrentCultureIgnoreCase)));
}
return Execute(contentQueryable, translator.OrderExpressions, translator.CallType, translator.Skip, translator.Take);
}
开发者ID:Godoy,项目名称:CMS,代码行数:29,代码来源:TextContentQueryExecutor.cs
示例3: TestReadPerformance
public void TestReadPerformance()
{
int count = 100000;
var contentObject = new ContentObject();
contentObject.UUID = Guid.NewGuid().ToString();
contentObject.UserKey = "userkey";
Stopwatch classStopwatch = new Stopwatch();
classStopwatch.Start();
for (int i = 0; i < count; i++)
{
var uuid = contentObject.UUID;
var userKey = contentObject.UserKey;
}
classStopwatch.Stop();
var dynamicContent = new TextContent();
dynamicContent.UUID = Guid.NewGuid().ToString();
dynamicContent.UserKey = "userkey";
Stopwatch dynamicStopwatch = new Stopwatch();
dynamicStopwatch.Start();
for (int i = 0; i < count; i++)
{
var uuid = dynamicContent.UUID;
var userKey = dynamicContent.UserKey;
}
dynamicStopwatch.Stop();
Console.WriteLine("class read:{0}ms", classStopwatch.ElapsedMilliseconds);
Console.WriteLine("dynamic object read:{0}ms", dynamicStopwatch.ElapsedMilliseconds);
}
开发者ID:Epitomy,项目名称:CMS,代码行数:30,代码来源:ContentModelPerformanceTests.cs
示例4: Test1
public void Test1()
{
TextContent content = new TextContent();
content.Repository = "repository1";
content.FolderName = "news";
content.UtcCreationDate = DateTime.Now;
content.UtcLastModificationDate = DateTime.Now;
content["title"] = "title1";
VersionManager.LogVersion(content);
Assert.AreEqual(1, VersionManager.AllVersions(content).First());
var version1 = VersionManager.GetVersion(content, 1);
Assert.AreEqual(content["title"], version1.TextContent["title"]);
Assert.AreEqual(content.UtcLastModificationDate, version1.UtcCommitDate);
//content["title"] = "title2";
//content.UtcLastModificationDate = DateTime.Now;
//VersionManager.LogVersion(content);
//Assert.AreEqual(2, VersionManager.AllVersions(content).Last());
//var version2 = VersionManager.GetVersion(content, 2);
//Assert.AreEqual(content["title"], version2.TextContent["title"]);
//Assert.AreEqual(content.UtcLastModificationDate, version2.UtcCommitDate);
}
开发者ID:Godoy,项目名称:CMS,代码行数:30,代码来源:VersioningManagerTests.cs
示例5: Execute
public override object Execute()
{
var contents = (IEnumerable<TextContent>)ContentQueryExecutor.Execute(CategoriesQuery.InnerQuery);
IQueryable<TextContent> categories = new TextContent[0].AsQueryable();
if (contents.Count() > 0)
{
categories = CategoriesQuery.CategoryFolder.GetSchema().GetContents().AsQueryable();
}
QueryExpressionTranslator translator = new QueryExpressionTranslator();
categories = translator.Translate(CategoriesQuery.Expression, categories);
var categoryData = CategoriesQuery.Repository.GetCategoryData()
.Where(it => it.CategoryFolder.EqualsOrNullEmpty(CategoriesQuery.CategoryFolder.FullName, StringComparison.CurrentCultureIgnoreCase))
.Where(it => contents.Any(c => it.ContentUUID.EqualsOrNullEmpty(c.UUID, StringComparison.CurrentCultureIgnoreCase)))
.ToArray();
categories = categories.Where(it => categoryData.Any(c => it.UUID.EqualsOrNullEmpty(c.CategoryUUID, StringComparison.CurrentCultureIgnoreCase)));
var result = Execute(categories, translator.OrderExpressions, translator.CallType, translator.Skip, translator.Take);
return result;
}
开发者ID:Godoy,项目名称:CMS,代码行数:26,代码来源:CategoriesQueryExecutor.cs
示例6: UpdateTextContent
public string UpdateTextContent(Site site, TextFolder textFolder, string uuid, System.Collections.Specialized.NameValueCollection values, [System.Runtime.InteropServices.OptionalAttribute][System.Runtime.InteropServices.DefaultParameterValueAttribute("")]string userid, string vendor)
{
var schema = textFolder.GetSchema();
var textContent = new TextContent(textFolder.Repository.Name, textFolder.SchemaName, textFolder.FullName);
textContent = _textContentBinder.Bind(schema, textContent, values);
IncomingQueue incomeQueue = new IncomingQueue()
{
Message = null,
Object = new Dictionary<string, object>(textContent),
ObjectUUID = textContent.IntegrateId,
ObjectTitle = textContent.GetSummary(),
Vendor = vendor,
PublishingObject = PublishingObject.TextContent,
Action = PublishingAction.Publish,
SiteName = site.FullName,
Status = QueueStatus.Pending,
UtcCreationDate = DateTime.UtcNow,
UtcProcessedTime = null,
UUID = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10)
};
_incomeQueueProvider.Add(incomeQueue);
return textContent.IntegrateId;
}
开发者ID:XitasoChris,项目名称:CMS,代码行数:26,代码来源:CmisIncomeDataManager.cs
示例7: TestAddCategory
public void TestAddCategory()
{
dynamic category1 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.Name)
{
UserKey = "category1"
};
category1.Title = "category1";
textContentProvider.Add(category1);
dynamic category2 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.Name)
{
UserKey = "category2"
};
category2.Title = "category2";
textContentProvider.Add(category2);
dynamic news1 = new TextContent(repository.Name, newsSchema.Name, newsFolder.Name)
{
UserKey = "news1"
};
news1.title = "news1";
textContentProvider.Add(news1);
textContentProvider.AddCategories(news1, new Category() { ContentUUID = news1.uuid, CategoryFolder = categoryFolder.FullName, CategoryUUID = (string)(category1.UUID) },
new Category() { ContentUUID = news1.uuid, CategoryFolder = categoryFolder.FullName, CategoryUUID = (string)(category2.UUID) });
textContentProvider.DeleteCategories(news1, new Category() { ContentUUID = news1.uuid, CategoryFolder = categoryFolder.FullName, CategoryUUID = (string)(category2.UUID) });
}
开发者ID:Epitomy,项目名称:CMS,代码行数:30,代码来源:TextContentProviderTests.cs
示例8: Insert
public void Insert()
{
TextContent news1 = new TextContent(repository.Name, newsSchema.Name, textFolder.FullName);
news1["Title"] = "title1";
news1["body"] = "body1";
provider.Add(news1);
}
开发者ID:Godoy,项目名称:CMS,代码行数:7,代码来源:InsertUpdateDeleteTests.cs
示例9: QueryTests
public QueryTests()
{
EmptyUserKeyGenerator.DefaultGenerator = new EmptyUserKeyGenerator();
Providers.DefaultProviderFactory = new MongoDB.ProviderFactory();
repository = new Repository(Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10).ToString());
Providers.DefaultProviderFactory.GetProvider<IRepositoryProvider>().Add(repository);
categorySchema = new Schema(repository, "category") { IsDummy = false };
categorySchema.AddColumn(new Column() { Name = "Title" });
categoryFolder = new TextFolder(repository, "Category") { SchemaName = categorySchema.Name, IsDummy = false };
Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(categoryFolder);
newsSchema = new Schema(repository, "News") { IsDummy = false };
newsSchema.AddColumn(new Column() { Name = "title", DataType = Data.DataType.String });
newsSchema.AddColumn(new Column() { Name = "Body", DataType = Data.DataType.String });
newsSchema.AddColumn(new Column() { Name = "Comments", DataType = Data.DataType.Int });
Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(newsSchema);
newsFolder = new TextFolder(repository, "News") { SchemaName = newsSchema.Name, Categories = new List<CategoryFolder>() { new CategoryFolder() { FolderName = categoryFolder.FullName, SingleChoice = false } }, OrderSetting = new OrderSetting() { FieldName = "Sequence", Direction = OrderDirection.Descending } };
Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(newsFolder);
commentSchema = new Schema(repository, "Comment") { IsDummy = false };
commentSchema.AddColumn(new Column() { Name = "Title" });
Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(commentSchema);
category1 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.FullName);
category1["title"] = "category1";
provider.Add(category1);
category2 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.FullName);
category2["title"] = "category2";
provider.Add(category2);
newsContent = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
newsContent["title"] = "news1";
newsContent["body"] = "body";
newsContent["comments"] = 1;
provider.Add(newsContent);
news2 = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
news2["title"] = "news2";
news2["body"] = "body";
news2["comments"] = 0;
provider.Add(news2);
news3 = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
news3["title"] = "news2";
news3["body"] = "body";
news3["comments"] = 5;
provider.Add(news3);
provider.AddCategories(newsContent, new Category() { ContentUUID = newsContent.UUID, CategoryUUID = category1.UUID, CategoryFolder = category1.FolderName });
provider.AddCategories(newsContent, new Category() { ContentUUID = newsContent.UUID, CategoryUUID = category2.UUID, CategoryFolder = category2.FolderName });
commenContent = new TextContent(repository.Name, commentSchema.Name, "");
commenContent.ParentFolder = newsContent.FolderName;
commenContent.ParentUUID = newsContent.UUID;
commenContent["title"] = "comment1";
provider.Add(commenContent);
}
开发者ID:Epitomy,项目名称:CMS,代码行数:60,代码来源:QueryTests.cs
示例10: InitializeData
private static void InitializeData()
{
dynamic news1 = new TextContent(repository.Name, newsSchema.Name, newsFolder.Name)
{
UserKey = "news1"
};
news1.title = "news1";
textContentProvider.Add(news1);
dynamic comment1 = new TextContent(repository.Name, commentSchema.Name, null)
{
UserKey = "comment1",
ParentUUID = news1.UUID
};
comment1.Title = "comment1";
textContentProvider.Add(comment1);
dynamic comment2 = new TextContent(repository.Name, commentSchema.Name, null)
{
UserKey = "comment2",
ParentUUID = news1.UUID
};
comment2.Title = "comment2";
textContentProvider.Add(comment2);
}
开发者ID:Godoy,项目名称:CMS,代码行数:28,代码来源:ParentQueryTests.cs
示例11: ContentVersionPath
public ContentVersionPath(TextContent content)
{
var contentPath = new TextContentPath(content);
var basePath = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve<Kooboo.CMS.Common.IBaseDir>();
var versionPath = Path.Combine(basePath.Cms_DataPhysicalPath, VersionPathName);
this.PhysicalPath = contentPath.PhysicalPath.Replace(basePath.Cms_DataPhysicalPath, versionPath);
}
开发者ID:Godoy,项目名称:CMS,代码行数:7,代码来源:ContentVersionPath.cs
示例12: Add
public string Add(string repositoryName, string folderName, string contentUUID, string fileName, byte[] binaryData)
{
var textContent = new TextContent(repositoryName, null, folderName) { UUID = contentUUID };
var ms = new MemoryStream(binaryData);
ms.Position = 0;
var contentFile = new ContentFile() { FileName = fileName, Stream = ms };
return FileUrlHelper.ResolveUrl(textContentFileProvider.Save(textContent, contentFile));
}
开发者ID:Epitomy,项目名称:CMS,代码行数:8,代码来源:TextContentFileService.cs
示例13: ContentVersionPath
public ContentVersionPath(TextContent content)
{
var contentPath = new TextContentPath(content);
var basePath = Path.Combine(Kooboo.Settings.BaseDirectory, RepositoryPath.Cms_Data);
var versionPath = Path.Combine(basePath, VersionPathName);
this.PhysicalPath = contentPath.PhysicalPath.Replace(basePath, versionPath);
// this.VirtualPath = UrlUtility.Combine(contentPath.VirtualPath, VersionPathName);
}
开发者ID:Epitomy,项目名称:CMS,代码行数:8,代码来源:ContentVersionPath.cs
示例14: ClearCategoreis
public SqlCeCommand ClearCategoreis(TextContent textContent)
{
string sql = string.Format("DELETE FROM [{0}] WHERE [email protected]"
, textContent.GetRepository().GetCategoryTableName());
SqlCeCommand command = new SqlCeCommand();
command.CommandText = sql;
command.Parameters.Add(new SqlCeParameter("@UUID", textContent.UUID));
return command;
}
开发者ID:Epitomy,项目名称:CMS,代码行数:9,代码来源:TextContentDbCommands.cs
示例15: DeleteChildContents
private static void DeleteChildContents(TextContent textContent, TextFolder parentFolder, TextFolder childFolder)
{
var repository = textContent.GetRepository();
var childContents = childFolder.CreateQuery().WhereEquals("ParentFolder", parentFolder.FullName)
.WhereEquals("ParentUUID", textContent.UUID);
foreach (var content in childContents)
{
Services.ServiceFactory.TextContentManager.Delete(repository, childFolder, content.UUID);
}
}
开发者ID:Godoy,项目名称:CMS,代码行数:10,代码来源:CascadingContentDeletingSubscriber.cs
示例16: Save
public string Save(TextContent content, ContentFile file)
{
var extension = Path.GetExtension(file.FileName);
var fileName = Kooboo.Extensions.StringExtensions.NormalizeUrl(Path.GetFileNameWithoutExtension(file.FileName)) + extension;
TextContentPath contentPath = new TextContentPath(content);
string filePath = Path.Combine(contentPath.PhysicalPath, fileName);
file.Stream.SaveAs(filePath, true);
return UrlUtility.Combine(contentPath.VirtualPath, fileName);
}
开发者ID:Epitomy,项目名称:CMS,代码行数:10,代码来源:TextContentFileProvider.cs
示例17: ClearCategories
public MySqlCommand ClearCategories(TextContent textContent)
{
string sql = string.Format("DELETE FROM `{0}` WHERE UUID=?UUID "
, textContent.GetRepository().GetCategoryTableName());
MySqlCommand command = new MySqlCommand();
command.CommandText = sql;
command.Parameters.Add(new MySqlParameter("?UUID", textContent.UUID));
return command;
}
开发者ID:Epitomy,项目名称:CMS,代码行数:10,代码来源:TextContentDbCommands.cs
示例18: GetVersion
public VersionInfo GetVersion(TextContent content, int version)
{
string versionFile = GetVersionFile(content, version);
if (File.Exists(versionFile))
{
var versionInfo = DataContractSerializationHelper.Deserialize<VersionInfo>(versionFile);
versionInfo.Version = version;
return versionInfo;
}
return null;
}
开发者ID:Godoy,项目名称:CMS,代码行数:11,代码来源:VersionManager.cs
示例19: EditFieldAttributes
public static IHtmlString EditFieldAttributes(TextContent data, string fieldName, FieldDataType dataType)
{
if (dataType == FieldDataType.Auto)
{
dataType = QueryFieldDataType(data, fieldName);
}
if (data == null || !Page_Context.Current.EnabledInlineEditing(EditingType.Content)
|| !Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableToEditContent(data, Page_Context.Current.ControllerContext.HttpContext.User.Identity.Name))
{
return new HtmlString("");
}
return new HtmlString(string.Format("editType=\"field\" dataType=\"{0}\" schema=\"{1}\" folder=\"{2}\" uuid=\"{3}\" fieldName=\"{4}\"", dataType.ToString(), data.SchemaName, data.FolderName, data.UUID, fieldName));
}
开发者ID:Godoy,项目名称:CMS,代码行数:13,代码来源:ViewHelper.cs
示例20: EditField
public static IHtmlString EditField(TextContent data, string fieldName, FieldDataType dataType)
{
if (dataType == FieldDataType.Auto)
{
dataType = QueryFieldDataType(data, fieldName);
}
if (data == null || !Page_Context.Current.EnabledInlineEditing(EditingType.Content)
|| !Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableToEditContent(data, Page_Context.Current.ControllerContext.HttpContext.User.Identity.Name))
{
return new HtmlString(data[fieldName] == null ? "" : data[fieldName].ToString());
}
var format = "<var start=\"true\" editType=\"field\" dataType=\"{0}\" schema=\"{1}\" folder=\"{2}\" uuid=\"{3}\" fieldName=\"{4}\" style=\"display:none;\"></var>{5}<var end=\"true\" style=\"display:none;\"></var>";
return new HtmlString(string.Format(format, dataType.ToString(), data.SchemaName, data.FolderName, data.UUID, fieldName, data[fieldName]));
}
开发者ID:Godoy,项目名称:CMS,代码行数:14,代码来源:ViewHelper.cs
注:本文中的Kooboo.CMS.Content.Models.TextContent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论