日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OrchardHUN.TrainingDemo 学习记录(2)-Migration中,添加contentPart 和widget

發布時間:2025/5/22 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OrchardHUN.TrainingDemo 学习记录(2)-Migration中,添加contentPart 和widget 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

例子:

using Orchard.ContentManagement.MetaData; using Orchard.Core.Contents.Extensions; using Orchard.Data.Migration; using Orchard.Environment.Extensions; using OrchardHUN.TrainingDemo.Models;namespace OrchardHUN.TrainingDemo {[OrchardFeature("OrchardHUN.TrainingDemo.Contents")]public class ContentsMigrations : DataMigrationImpl{public int Create(){SchemaBuilder.CreateTable(typeof(PersonListPartRecord).Name, table => table// Since PersonListPartRecord is a ContentPartRecord we have to use this method here. For ContentPartVersionRecord we would// simply use ContentPartVersionRecord() .ContentPartRecord().Column<string>("Sex").Column<int>("MaxCount"));/* * We make PersonListPart attachable. This means from the admin UI you'll be able to attach this part to any conent type. This step* is not necessary to attach the part to types from migrations like we do it from here.* Default is not attachable.*/ContentDefinitionManager.AlterPartDefinition(typeof(PersonListPart).Name,builder => builder.Attachable());/** We create a new content type. Note that there's only an alter method: this will create the type if it doesn't exist or modify it* if it does. Make sure you understand what content types are: http://docs.orchardproject.net/Documentation/Content-types* The content type's name is arbitrary, but choose a meaningful one.* Notice that we attach parts by specifying their name. For our own parts we use typeof().Name: this is not mandatory but serves* great if we change the part's name during development. (The same goes for record name BTW.)*/ContentDefinitionManager.AlterTypeDefinition("PersonList", cfg => cfg// Setting display name for the type. BTW the default is the technical name separated on capital letters, so the same here..DisplayedAs("Person List").WithPart("TitlePart") // So the list can have a title; TitlePart is a core part// AutoroutePart so the list can have a friendly URL. That's why this feature depends on Orchard.Autoroute..WithPart("AutoroutePart", builder => builder// These are TypePart settings: settings for a part on a specific type. I.e. AutoroutePart have the following settings// for PersonList. Take a look at AutoroutePart settings on the type editor UI of PersonList to see what these mean..WithSetting("AutorouteSettings.AllowCustomPattern", "true").WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false")// Specifying a custom URL-pattern for PersonList items.WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: 'person-lists/{Content.Slug}', Description: 'my-list'}]").WithSetting("AutorouteSettings.DefaultPatternIndex", "0")).WithPart(typeof(PersonListPart).Name)// CommonPart includes e.g. creation date and owner. Take a look at it (search with Ctrl+comma).// Also without it we can't list content types of this type on the admin UI (because the dates stored in it are needed for // ordering)..WithPart("CommonPart").Creatable() // This means users will be able to create such items from the admin UI. Default is the opposite. );/** With the same part we also create a widget. That's why this feature also depends on Orchard.Widgets!* Note that widgets should* - Have CommonPart attached* - Have WidgetPart attached* - Have the stereotype "Widget"*/ContentDefinitionManager.AlterTypeDefinition("PersonListWidget",cfg => cfg.WithPart(typeof(PersonListPart).Name).WithPart("WidgetPart").WithPart("CommonPart").WithSetting("Stereotype", "Widget"));return 1;// Please don't read UpdateFrom1() yet.// You read it, didn't you? Stop spoiling.// NEXT STATION: Handlers/PersonListPartHandler }public int UpdateFrom1(){// We're attaching the YouTubeEmbedField to the PersonListPart, which is already attached to the PersonList type.ContentDefinitionManager.AlterPartDefinition(typeof(PersonListPart).Name,builder => builder// This name distinguishes between fields if there are multiple ones of the same type on the part.WithField("YouTubeVideoEmbed",f => f.WithDisplayName("YouTube Video Embed") // This will be displayed as the name.OfType(typeof(YouTubeEmbedField).Name)));// We've attached the field here to an existing part, but we could have created a new part (just giving an arbitrary name as// the argument for AlterPartDefinition() would be enough) too.// Note that fields are always attached to parts. If you attach fields seemingly directly to a content type fromt the admin UI// in the background an invisible part is created, having the same name as the type.return 2;// NEXT STATION: Drivers/YouTubeEmbedFieldDriver.cs }} }

?

轉載于:https://www.cnblogs.com/zsanhong/archive/2013/05/27/3101128.html

總結

以上是生活随笔為你收集整理的OrchardHUN.TrainingDemo 学习记录(2)-Migration中,添加contentPart 和widget的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲一区二区三区精品视频 | 亚洲成人福利视频 | 777精品视频| jizzzxxxx | 午夜看片 | av中文字幕第一页 | 97人妻精品一区二区三区免费 | jizz教师| 男女黄床上色视频 | 操日韩| 九九九免费 | 奇米影视7777 | 日韩精品一区二区三区不卡 | 中文久久字幕 | 亚洲国产麻豆 | 波多野结衣有码 | 亚洲国产精品成人综合 | 97人人人| 精品在线播放视频 | 欧美日韩精品一区二区三区四区 | 人人爽人人爽人人爽人人爽 | 在线精品一区二区 | 精品国产欧美一区二区三区成人 | 日本乱偷中文字幕 | 成人二区三区 | 成年人视频在线看 | 国产三级一区二区三区 | www.一区| 99久免费精品视频在线观78 | 麻豆一区产品精品蜜桃的特点 | 日韩欧美中字 | 电影《两个尼姑》免费播放 | 国产精品成人国产乱 | 免费黄色片网站 | 国产美女极度色诱视频www | 午夜剧场在线 | 激情专区 | 综合久久综合 | 99无码熟妇丰满人妻啪啪 | 亚洲色图 校园春色 | 成人禁污污啪啪入口 | 1000部啪啪 | 波多野结衣亚洲视频 | a√天堂资源| 亚洲一区二区三区人妻 | 嫩草影院国产 | 久热精品视频在线观看 | www.在线观看av | 欧美大片一区二区三区 | 美女视频网址 | 国产理论视频在线观看 | 精品视频一区二区三区四区五区 | 三级av毛片 | 女性裸体无遮挡胸 | 国产91边播边对白在线 | 国产男女在线 | 日本熟妇色xxxxx日本免费看 | 久久精品成人一区二区三区蜜臀 | 国产原创一区 | 天堂999 | 实拍女处破www免费看 | 亚洲国产欧美在线人成 | 成人在线观看免费视频 | 美女视频久久 | 天堂综合 | 国产日韩一区二区三区在线观看 | 精品视频在线免费看 | 日韩欧美无 | www黄色av | 538国产精品视频一区二区 | 99久久精品国产毛片 | 丰满人妻在公车被猛烈进入电影 | 谁有免费的黄色网址 | 国产人妻人伦精品1国产盗摄 | 国产少妇一区二区 | 四虎影视永久 | 妺妺窝人体色www聚色窝仙踪 | 日日日夜夜操 | 性xx紧缚网站 | 欧美黑人添添高潮a片www | 黄色片网站在线免费观看 | 超碰最新网址 | 一区二区观看 | 亚洲天堂久 | 伊人影院综合 | 中文字幕无码乱码人妻日韩精品 | 国产伦精品一区二区三区高清版禁 | 亚洲日本护士毛茸茸 | 伊人成年综合网 | 淫羞阁av导航 | 日韩一级片视频 | 国产日日干 | 日本bbwbbw | 欧美日日日 | 天天干天天操天天射 | 亚洲色成人www永久网站 | 国产 日韩 欧美 在线 | 国产最新视频 | av资源新版在线天堂 |