orchardcore的一些资料

OrchardCore的liquid常用的命令

* if, endif, elsif, else, unless, endunless, 
* case, endcase, 
* when, 
* for, endfor, 
* continue, break, 
* comment, endcomment, 
* raw, endraw, 
* cycle, assign, 
* capture, endcapture, 
* increment, decrement, 
* include, render_body, 
* render_section, page_title, 
* antiforgerytoken, 
* layout, shape_clear_alternates, 
* shape_add_alternates, shape_clear_wrappers, 
* shape_add_wrappers, shape_clear_classes, 
* shape_add_classes, shape_clear_attributes, 
* shape_add_attributes, shape_type, shape_display_type, 
* shape_position, shape_cache, shape_tab, 
* shape_remove_item, shape_pager, helper, 
* shape, link, meta, resources, script, 
* style, block, endblock, a, enda, 
* zone, endzone, scriptblock, 
* endscriptblock, cache, endcache, 
* cache_dependency, cache_expires_on, 
* cache_expires_after, cache_expires_sliding 

workflow工作流例子

ideliverable的例子

oc 如何在liquid模板中构建数组对象

用于图像列表

{
    "value": [
         for client in content.Clients.value 
            {
                "ACCOUNTNUM": "",
                "EMAIL": "",
                "NAME": "",
                "PHONE": "",
                "VATNUM": "",
                "RECID": "",
                "CANALID": "",
                "CANALDESC": ""
            }, 
          endfor  
    ]
}

WPF 集成 OrchardCore 测试

截图

结果

生成单个exe成功,运行速度有点慢,再次打包遇到Http 500 问题,用vs 20222调试代码的生成速度太慢了,生成的单个文件大小为155MB,我决定放弃这个方向了。

缺点总结

  1. 生成代码慢非常降低调试速度
  2. 生成的包太大了,electron才不到100MB
  3. 代码没有加密过,但是运行速度就是有点慢,可能是webview2造成的,不清楚原因,wpf的webbrowser更难用,直接js报错,使用wpf集成浏览器这个方向还是太新了

模块用例

Set Property 例子

"2 + 2"

"workflowContext.Properties['someProperty']"

"workflowContext.Input['age'] >= 18 ? 'Adult' : 'Minor'"

"workflowContext.Input['name'].toUpperCase()"

"new Date(workflowContext.Input['date']).getFullYear()"

"workflowContext.Input['items'].filter(item => item.price > 100).length"

"Workflow.Input.ContentItem.Content.MarkdownBodyPart.Markdown"

"JSON.parse(workflowContext.Input['jsonString']).propertyName"

"(() => { 
   let total = 0; 
   workflowContext.Input['orders'].forEach(order => total += order.amount); 
   return total > 1000 ? 'High Value' : 'Standard';
 })()"

Content Json

"ContentItemId": "[js: uuid()]",
"Owner": "[js: parameters('AdminUserId')]",
"Author": "[js: parameters('AdminUsername')]",

其他

halt() 会执行上一次记录的那个workflow的时间记录地址,而不是刚刚定义的

orchardcore中的数字Filed需要定义值,如果默认为空即为null,内部workflow序列化的时候会报错,会没有提示,没有workflow显示


作者:spike

分类: Net

创作时间:2024-05-25

更新时间:2024-10-17

联系方式放在中括号之中例如[[email protected]],回复评论在开头加上标号例如:#1