SkyoceanHome
Home
Privacy
ダウンロード
SkyShop
Updated Information
チュートリアルコード集
References
記事編集
日付
ジャンルのカテゴリ―名
名前を選択して下さい。
Contexts
Controllers
Databases
Htmls
JavaScripts
Models
MVCTutorials
Others
Styles
Views
タイトル
内容の要旨
<p data-bm="62" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: 4px; padding: revert; -webkit-line-clamp: revert; color: rgba(0, 0, 0, 0.8); font-family: roboto, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pasted="true">了解です。<br>前回のモデルとサンプルデータを、さらに <strong style="font-weight: 700;">多言語対応</strong> と <strong style="font-weight: 700;">SEO向け設定</strong> を組み込んだ形にリファインします。<br>今回の改良点は以下です。</p><ul data-bm="63" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: revert; padding: revert; color: rgba(0, 0, 0, 0.8); font-family: roboto, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;"><strong style="font-weight: 700;">多言語対応</strong>:<code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);">TitleEn</code> / <code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);">DescriptionEn</code> を追加し、英語表示にも対応</li><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;"><strong style="font-weight: 700;">SEO対応</strong>:<code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);">Slug</code> プロパティを追加し、URL生成やSEO最適化に利用可能</li><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;"><strong style="font-weight: 700;">IsVisibleInMenu</strong> を追加し、メニューには表示しないが直接アクセス可能なページを制御</li><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;">サンプルデータを多言語・SEOを意識した形に変更</li></ul><h2 data-bm="64" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: revert; padding: revert; font: 22px / 24px roboto, helvetica, sans-serif; height: 32px; -webkit-line-clamp: 1; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; color: rgba(0, 0, 0, 0.8); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">モデル例(Menu.cs)</h2><pre data-priority="2" data-bm="65" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(245, 245, 245); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 8px; overflow: hidden; color: rgba(0, 0, 0, 0.8); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div data-bm="72" style="display: flex; height: 28px; flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.1); background: none 0% 0% / auto repeat scroll padding-box border-box rgb(243, 249, 254);"><h5 style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: 0px; padding: revert; font-style: normal !important; font-variant: normal !important; font-weight: 400 !important; font-stretch: 100% !important; line-height: 18px; font-family: roboto, helvetica, sans-serif !important; font-optical-sizing: auto !important; font-size-adjust: none !important; font-kerning: auto !important; font-feature-settings: normal !important; font-variation-settings: normal !important; font-language-override: normal !important; font-size: 16px; display: inline-block; color: rgb(11, 73, 127);">Csharp</h5><div style="height: 28px;"><button type="button" tabindex="" title="Copy code" style="box-sizing: border-box; margin: 0px; padding: 0px; font: 400 13px / 20px roboto, helvetica, sans-serif; background-color: rgb(225, 240, 253); border: 1px solid rgba(0, 0, 0, 0); display: grid; grid-auto-flow: column; align-items: center; cursor: pointer; color: rgb(0, 0, 0) !important; text-decoration: none !important; border-radius: 9999px; block-size: 28px; gap: 2px; padding-inline: 10px;"><div style="box-sizing: border-box; margin: 0px; padding: 0px; min-inline-size: 0px; max-inline-size: 100%; white-space: nowrap; text-overflow: ellipsis; overflow: clip; max-block-size: calc(1lh); padding-inline: 2px;">Copy code</div></button></div></div><code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255); display: block; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 16px 16px;"><span style="color: rgb(215, 58, 73);">using</span> System.Collections.Generic; <span style="color: rgb(215, 58, 73);">using</span> System.ComponentModel.DataAnnotations; <span style="color: rgb(215, 58, 73);">using</span> System.ComponentModel.DataAnnotations.Schema; <span style="color: rgb(215, 58, 73);">namespace</span> <span style="color: rgb(111, 66, 193);">MyApp.Models</span> { <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> <span style="color: rgb(215, 58, 73);"><summary></span></span> <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> 階層型メニュー項目モデル(多言語・SEO対応)</span> <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> <span style="color: rgb(215, 58, 73);"></summary></span></span> <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(215, 58, 73);">class</span> <span style="color: rgb(111, 66, 193);">Menu</span> { [<span style="color: rgb(0, 92, 197);">Key</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">int</span> Id { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">Required</span>] [<span style="color: rgb(0, 92, 197);">MaxLength(100)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> Title { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">MaxLength(100)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> TitleEn { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">MaxLength(200)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> Url { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> <span style="color: rgb(215, 58, 73);"><summary></span></span> <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> SEO用スラッグ(URL生成に利用)</span> <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> <span style="color: rgb(215, 58, 73);"></summary></span></span> [<span style="color: rgb(0, 92, 197);">MaxLength(100)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> Slug { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">int</span> SortOrder { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } = <span style="color: rgb(0, 92, 197);">0</span>; <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">bool</span> IsActive { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } = <span style="color: rgb(0, 92, 197);">true</span>; <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> <span style="color: rgb(215, 58, 73);"><summary></span></span> <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> メニューに表示するかどうか(falseなら直接アクセスのみ)</span> <span style="color: rgb(106, 115, 125);"><span style="color: rgb(215, 58, 73);">///</span> <span style="color: rgb(215, 58, 73);"></summary></span></span> <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">bool</span> IsVisibleInMenu { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } = <span style="color: rgb(0, 92, 197);">true</span>; [<span style="color: rgb(0, 92, 197);">MaxLength(50)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> IconClass { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">MaxLength(250)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> Description { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">MaxLength(250)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> DescriptionEn { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">MaxLength(20)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> Target { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } = <span style="color: rgb(3, 47, 98);">"_self"</span>; [<span style="color: rgb(0, 92, 197);">MaxLength(50)</span>] <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">string</span> PermissionKey { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(227, 98, 9);">int</span>? ParentId { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } [<span style="color: rgb(0, 92, 197);">ForeignKey(<span style="color: rgb(3, 47, 98);">"ParentId"</span>)</span>] <span style="color: rgb(215, 58, 73);">public</span> Menu Parent { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } <span style="color: rgb(215, 58, 73);">public</span> ICollection<Menu> Children { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } = <span style="color: rgb(215, 58, 73);">new</span> List<Menu>(); } } </code></pre><h2 data-bm="66" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: revert; padding: revert; font: 22px / 24px roboto, helvetica, sans-serif; height: 32px; -webkit-line-clamp: 1; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; color: rgba(0, 0, 0, 0.8); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">サンプルデータ(Seed)</h2><pre data-priority="2" data-bm="67" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(245, 245, 245); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 8px; overflow: hidden; color: rgba(0, 0, 0, 0.8); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div data-bm="73" style="display: flex; height: 28px; flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.1); background: none 0% 0% / auto repeat scroll padding-box border-box rgb(243, 249, 254);"><h5 style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: 0px; padding: revert; font-style: normal !important; font-variant: normal !important; font-weight: 400 !important; font-stretch: 100% !important; line-height: 18px; font-family: roboto, helvetica, sans-serif !important; font-optical-sizing: auto !important; font-size-adjust: none !important; font-kerning: auto !important; font-feature-settings: normal !important; font-variation-settings: normal !important; font-language-override: normal !important; font-size: 16px; display: inline-block; color: rgb(11, 73, 127);">Csharp</h5><div style="height: 28px;"><button type="button" tabindex="" title="Copy code" style="box-sizing: border-box; margin: 0px; padding: 0px; font: 400 13px / 20px roboto, helvetica, sans-serif; background-color: rgb(225, 240, 253); border: 1px solid rgba(0, 0, 0, 0); display: grid; grid-auto-flow: column; align-items: center; cursor: pointer; color: rgb(0, 0, 0) !important; text-decoration: none !important; border-radius: 9999px; block-size: 28px; gap: 2px; padding-inline: 10px;"><div style="box-sizing: border-box; margin: 0px; padding: 0px; min-inline-size: 0px; max-inline-size: 100%; white-space: nowrap; text-overflow: ellipsis; overflow: clip; max-block-size: calc(1lh); padding-inline: 2px;">Copy code</div></button></div></div><code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255); display: block; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 16px 16px;"><span style="color: rgb(215, 58, 73);">using</span> Microsoft.EntityFrameworkCore; <span style="color: rgb(215, 58, 73);">using</span> MyApp.Models; <span style="color: rgb(215, 58, 73);">namespace</span> <span style="color: rgb(111, 66, 193);">MyApp.Data</span> { <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(215, 58, 73);">class</span> <span style="color: rgb(111, 66, 193);">AppDbContext</span> : <span style="color: rgb(111, 66, 193);">DbContext</span> { <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(111, 66, 193);">DbSet</span><<span style="color: rgb(111, 66, 193);">Menu</span>> Menus { <span style="color: rgb(215, 58, 73);">get</span>; <span style="color: rgb(215, 58, 73);">set</span>; } <span style="color: rgb(215, 58, 73);">public</span> <span style="color: rgb(111, 66, 193);">AppDbContext</span>(DbContextOptions<AppDbContext> options) : <span style="color: rgb(111, 66, 193);">base</span>(options) { } <span style="color: rgb(215, 58, 73);">protected</span> <span style="color: rgb(215, 58, 73);">override</span> <span style="color: rgb(215, 58, 73);">void</span> <span style="color: rgb(111, 66, 193);">OnModelCreating</span>(ModelBuilder modelBuilder) { <span style="color: rgb(106, 115, 125);">// トップレベルメニュー</span> modelBuilder.Entity<Menu>().HasData( <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">1</span>, Title = <span style="color: rgb(3, 47, 98);">"ホーム"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Home"</span>, Url = <span style="color: rgb(3, 47, 98);">"/"</span>, Slug = <span style="color: rgb(3, 47, 98);">"home"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">1</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-home"</span>, Description = <span style="color: rgb(3, 47, 98);">"サイトのトップページ"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"Website home page"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"Guest"</span> }, <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">2</span>, Title = <span style="color: rgb(3, 47, 98);">"サービス"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Services"</span>, Url = <span style="color: rgb(3, 47, 98);">"/services"</span>, Slug = <span style="color: rgb(3, 47, 98);">"services"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">2</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-cogs"</span>, Description = <span style="color: rgb(3, 47, 98);">"提供サービス一覧"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"List of services"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"User"</span> }, <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">3</span>, Title = <span style="color: rgb(3, 47, 98);">"ブログ"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Blog"</span>, Url = <span style="color: rgb(3, 47, 98);">"/blog"</span>, Slug = <span style="color: rgb(3, 47, 98);">"blog"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">3</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-blog"</span>, Description = <span style="color: rgb(3, 47, 98);">"最新ニュースと記事"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"Latest news and articles"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"Guest"</span> } ); <span style="color: rgb(106, 115, 125);">// 子メニュー(サービス)</span> modelBuilder.Entity<Menu>().HasData( <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">4</span>, Title = <span style="color: rgb(3, 47, 98);">"Web開発"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Web Development"</span>, Url = <span style="color: rgb(3, 47, 98);">"/services/web"</span>, Slug = <span style="color: rgb(3, 47, 98);">"web-development"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">1</span>, ParentId = <span style="color: rgb(0, 92, 197);">2</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-code"</span>, Description = <span style="color: rgb(3, 47, 98);">"Webアプリ開発"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"Web application development"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"User"</span> }, <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">5</span>, Title = <span style="color: rgb(3, 47, 98);">"モバイルアプリ"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Mobile Apps"</span>, Url = <span style="color: rgb(3, 47, 98);">"/services/mobile"</span>, Slug = <span style="color: rgb(3, 47, 98);">"mobile-apps"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">2</span>, ParentId = <span style="color: rgb(0, 92, 197);">2</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-mobile"</span>, Description = <span style="color: rgb(3, 47, 98);">"スマホアプリ開発"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"Mobile application development"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"User"</span> } ); <span style="color: rgb(106, 115, 125);">// 孫メニュー(Web開発)</span> modelBuilder.Entity<Menu>().HasData( <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">6</span>, Title = <span style="color: rgb(3, 47, 98);">"フロントエンド"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Frontend"</span>, Url = <span style="color: rgb(3, 47, 98);">"/services/web/frontend"</span>, Slug = <span style="color: rgb(3, 47, 98);">"frontend"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">1</span>, ParentId = <span style="color: rgb(0, 92, 197);">4</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-desktop"</span>, Description = <span style="color: rgb(3, 47, 98);">"UI/UX設計"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"UI/UX design"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"User"</span> }, <span style="color: rgb(215, 58, 73);">new</span> Menu { Id = <span style="color: rgb(0, 92, 197);">7</span>, Title = <span style="color: rgb(3, 47, 98);">"バックエンド"</span>, TitleEn = <span style="color: rgb(3, 47, 98);">"Backend"</span>, Url = <span style="color: rgb(3, 47, 98);">"/services/web/backend"</span>, Slug = <span style="color: rgb(3, 47, 98);">"backend"</span>, SortOrder = <span style="color: rgb(0, 92, 197);">2</span>, ParentId = <span style="color: rgb(0, 92, 197);">4</span>, IsActive = <span style="color: rgb(0, 92, 197);">true</span>, IsVisibleInMenu = <span style="color: rgb(0, 92, 197);">true</span>, IconClass = <span style="color: rgb(3, 47, 98);">"fa fa-server"</span>, Description = <span style="color: rgb(3, 47, 98);">"API・DB構築"</span>, DescriptionEn = <span style="color: rgb(3, 47, 98);">"API and database development"</span>, Target = <span style="color: rgb(3, 47, 98);">"_self"</span>, PermissionKey = <span style="color: rgb(3, 47, 98);">"User"</span> } ); } } } </code></pre><h2 data-bm="68" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: revert; padding: revert; font: 22px / 24px roboto, helvetica, sans-serif; height: 32px; -webkit-line-clamp: 1; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; color: rgba(0, 0, 0, 0.8); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">改良ポイント</h2><ul data-bm="69" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: revert; padding: revert; color: rgba(0, 0, 0, 0.8); font-family: roboto, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;"><strong style="font-weight: 700;">多言語対応</strong>:<code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);">TitleEn</code> / <code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);">DescriptionEn</code> により、UI言語切替が可能。</li><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;"><strong style="font-weight: 700;">SEO対応</strong>:<code style="border-radius: 8px; background: none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255);">Slug</code> を使ってクリーンURL生成や検索エンジン最適化が可能。</li><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;"><strong style="font-weight: 700;">IsVisibleInMenu</strong> により、メニュー非表示ページ(LPやキャンペーンページなど)も管理可能。</li><li style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin-top: revert; margin-right: revert; margin-bottom: 8px; margin-left: revert; padding: revert;">サンプルデータは日本語・英語両方を含み、国際化対応サイトを想定。</li></ul><p data-bm="70" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: 4px; padding: revert; -webkit-line-clamp: revert; color: rgba(0, 0, 0, 0.8); font-family: roboto, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">このバージョンを使えば、<strong style="font-weight: 700;">多言語対応の階層ドロップダウンメニュー</strong>を構築できます。<br>もし希望があれば、このモデルを使った <strong style="font-weight: 700;">言語切替対応の Razor View 実装例</strong> も提示できます。</p><p data-bm="71" style="border: 0px; border-collapse: collapse; border-spacing: 0px; list-style-position: initial; list-style-image: initial; list-style-type: revert; margin: 4px; padding: revert; -webkit-line-clamp: revert; color: rgba(0, 0, 0, 0.8); font-family: roboto, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">次はこの多言語モデルを使って、<strong style="font-weight: 700;">言語切替付き階層ドロップダウン描画コード</strong>を作りますか?</p><p data-f-id="pbf" style="text-align: center; font-size: 14px; margin-top: 30px; opacity: 0.65; font-family: sans-serif;">Powered by <a href="https://www.froala.com/wysiwyg-editor?pb=1" title="Froala Editor">Froala Editor</a></p>
コピーする
添付画像
画像を変更
Back to List
//検索文:Editor内でHTMLコードをコピーさせる