Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Glass Mapper、TDS代码生成和Sitecore中的富文本字段_Sitecore_Glass Mapper_Tds - Fatal编程技术网

Glass Mapper、TDS代码生成和Sitecore中的富文本字段

Glass Mapper、TDS代码生成和Sitecore中的富文本字段,sitecore,glass-mapper,tds,Sitecore,Glass Mapper,Tds,使用Glass.Mapper版本3.0.13.25。 使用TDS 5.0.0.23代码生成(glassv3header.tt和glassv3item.tt) 我有一个新项目,我正试图添加到Sitecore。我正在填充通过TDS的代码生成创建的产品对象 Product createdProduct = service.Create(DestinationFolder, newProduct); 当我尝试运行代码时,出现以下错误 如果富文本字段中的数据不是原始数据,则无法保存该字段中的数据。请将S

使用Glass.Mapper版本3.0.13.25。 使用TDS 5.0.0.23代码生成(glassv3header.tt和glassv3item.tt)

我有一个新项目,我正试图添加到Sitecore。我正在填充通过TDS的代码生成创建的产品对象

Product createdProduct = service.Create(DestinationFolder, newProduct);
当我尝试运行代码时,出现以下错误

如果富文本字段中的数据不是原始数据,则无法保存该字段中的数据。请将SitecoreFieldAttribute设置属性设置为SitecoreFieldSettings.RichTextRaw,以获取Mizuno.data.Domain.Product类型上的属性完整描述

查看Glass Mapper代码,看起来我必须将一些config.Setting设置为SitecoreFieldSettings.RichTextRaw,但我不确定使用TDS生成的代码执行此操作的内容/位置/方式

对此的任何见解都会有所帮助


-Sarkis-

我认为这在TDS中是不可能的,除非您更改标准TT模板,然后在TDS中使用自定义数据。这可能需要做很多工作

您最好对原始模型进行子分类,然后添加一个不同的属性,我还没有对此进行测试,但它应该可以工作:

public class ProductWrite : Mizuno.Data.Domain.Product {

    [SitecoreField(Settings = SitecoreFieldSettings.RichTextRaw)]
    public override string Full_Description { get; set; }

} 

让我知道这是否有效。

嘿,有点晚了,但我已经找到了解决方案。因此,首先必须禁用该项的代码生成。转到TDS项目右键单击,然后单击属性。在None中有一个名为“代码生成模板”的字段集,在类中将其作为属性:

[SitecoreField("FieldName", Setting = SitecoreFieldSettings.RichTextRaw)]
public virtual string FieldName { get; set; }
希望能有帮助