{"id":76683,"date":"2026-02-23T01:25:25","date_gmt":"2026-02-22T17:25:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/76683.html"},"modified":"2026-02-23T01:25:25","modified_gmt":"2026-02-22T17:25:25","slug":"%e7%a1%ae%e4%bf%9d%e6%95%b0%e6%8d%ae%e5%ae%8c%e6%95%b4%e6%80%a7%e7%9a%84entity-framework-core%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/76683.html","title":{"rendered":"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5"},"content":{"rendered":"<p>\u5728\u73b0\u4ee3\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6570\u636e\u6a21\u578b\u7684\u8bbe\u8ba1\u548c\u6570\u636e\u5b8c\u6574\u6027\u7684\u7ef4\u62a4\u662f\u81f3\u5173\u91cd\u8981\u7684\u4efb\u52a1\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528Entity Framework Core\uff08EF Core\uff09\u786e\u4fdd\u6570\u636e\u6a21\u578b\u4e2d\u7684CatOwner\u548cDogOwner\u8868\u7684PetType\u5b57\u6bb5\u53ea\u80fd\u5173\u8054\u5230\u6b63\u786e\u7c7b\u578b\u7684\u5ba0\u7269\u7c7b\u578b\u3002<\/p>\n<h4>\u6570\u636e\u6a21\u578b\u6982\u8ff0<\/h4>\n<p>\u6211\u4eec\u6709\u4e00\u4e2a\u57fa\u7840\u6a21\u578bOwner\uff0c\u5b83\u901a\u8fc7PetId\u5173\u8054\u5230\u5ba0\u7269\u3002\u6839\u636e\u5ba0\u7269\u7c7b\u578b\uff0c\u6211\u4eec\u5c06\u5176\u5206\u79bb\u4e3a\u4e24\u4e2a\u5177\u4f53\u7684\u8868\uff1aCatOwner\u548cDogOwner\u3002\u8fd9\u4e24\u4e2a\u8868\u4e0d\u4ec5\u5305\u542b\u4e86\u6240\u6709\u8005\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u8fd8\u5305\u542b\u4e86\u5ba0\u7269\u7684\u7c7b\u578b\uff08PetType\uff09\u3002PetType\u8868\u5b9a\u4e49\u4e86\u6bcf\u4e2a\u5ba0\u7269\u53ef\u4ee5\u6709\u7684\u7c7b\u578b\uff0c\u5982Grumpy\u3001Friendly\u3001Cute\u7b49\u3002<\/p>\n<h4>\u95ee\u9898\u63cf\u8ff0<\/h4>\n<p>\u4e1a\u52a1\u9700\u6c42\u8981\u6c42CatOwner\u4e0d\u80fd\u5173\u8054\u5230Dog\u7c7b\u578b\u7684\u5ba0\u7269\uff0c\u540c\u6837\uff0cDogOwner\u4e0d\u80fd\u5173\u8054\u5230Cat\u7c7b\u578b\u7684\u5ba0\u7269\u3002\u5982\u4f55\u5728EF Core\u4e2d\u5b9e\u73b0\u8fd9\u4e00\u9650\u5236\uff1f<\/p>\n<h4>\u89e3\u51b3\u65b9\u6848\u63a2\u8ba8<\/h4>\n<li>\n<p>\u6570\u636e\u6ce8\u91ca\uff08Data Annotations\uff09\uff1a EF Core\u901a\u8fc7\u6570\u636e\u6ce8\u91ca\u63d0\u4f9b\u4e86\u4e00\u4e9b\u57fa\u7840\u7684\u9a8c\u8bc1\u673a\u5236\uff0c\u4f46\u8fd9\u4e9b\u9a8c\u8bc1\u4e0d\u80fd\u76f4\u63a5\u5728\u6570\u636e\u5e93\u5c42\u9762\u4fdd\u8bc1\u6570\u636e\u7684\u5b8c\u6574\u6027\u3002\u4f8b\u5982\uff1a<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u73b0\u4ee3\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6570\u636e\u6a21\u578b\u7684\u8bbe\u8ba1\u548c\u6570\u636e\u5b8c\u6574\u6027\u7684\u7ef4\u62a4\u662f\u81f3\u5173\u91cd\u8981\u7684\u4efb\u52a1\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528Entity Framework Core\uff08EF Core\uff09\u786e\u4fdd\u6570\u636e\u6a21\u578b\u4e2d\u7684CatOwner\u548cDogOwner\u8868\u7684PetType\u5b57\u6bb5\u53ea\u80fd\u5173\u8054\u5230\u6b63\u786e\u7c7b\u578b\u7684\u5ba0\u7269\u7c7b\u578b\u3002<br \/>\n\u6570\u636e\u6a21\u578b\u6982\u8ff0<br \/>\n\u6211\u4eec\u6709\u4e00\u4e2a\u57fa\u7840\u6a21\u578bOwner\uff0c\u5b83\u901a\u8fc7PetId\u5173\u8054\u5230\u5ba0\u7269\u3002\u6839\u636e\u5ba0\u7269\u7c7b\u578b\uff0c\u6211\u4eec\u5c06\u5176\u5206\u79bb\u4e3a\u4e24\u4e2a\u5177\u4f53\u7684\u8868\uff1aCatOwner\u548cDogOwner\u3002\u8fd9\u4e24\u4e2a\u8868\u4e0d\u4ec5\u5305\u542b\u4e86\u6240\u6709\u8005\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u8fd8\u5305\u542b\u4e86\u5ba0\u7269\u7684\u7c7b\u578b\uff08PetType\uff09\u3002P<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[604,569,100],"topic":[],"class_list":["post-76683","post","type-post","status-publish","format-standard","hentry","category-server","tag-oracle","tag-569","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/76683.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728\u73b0\u4ee3\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6570\u636e\u6a21\u578b\u7684\u8bbe\u8ba1\u548c\u6570\u636e\u5b8c\u6574\u6027\u7684\u7ef4\u62a4\u662f\u81f3\u5173\u91cd\u8981\u7684\u4efb\u52a1\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528Entity Framework Core\uff08EF Core\uff09\u786e\u4fdd\u6570\u636e\u6a21\u578b\u4e2d\u7684CatOwner\u548cDogOwner\u8868\u7684PetType\u5b57\u6bb5\u53ea\u80fd\u5173\u8054\u5230\u6b63\u786e\u7c7b\u578b\u7684\u5ba0\u7269\u7c7b\u578b\u3002 \u6570\u636e\u6a21\u578b\u6982\u8ff0 \u6211\u4eec\u6709\u4e00\u4e2a\u57fa\u7840\u6a21\u578bOwner\uff0c\u5b83\u901a\u8fc7PetId\u5173\u8054\u5230\u5ba0\u7269\u3002\u6839\u636e\u5ba0\u7269\u7c7b\u578b\uff0c\u6211\u4eec\u5c06\u5176\u5206\u79bb\u4e3a\u4e24\u4e2a\u5177\u4f53\u7684\u8868\uff1aCatOwner\u548cDogOwner\u3002\u8fd9\u4e24\u4e2a\u8868\u4e0d\u4ec5\u5305\u542b\u4e86\u6240\u6709\u8005\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u8fd8\u5305\u542b\u4e86\u5ba0\u7269\u7684\u7c7b\u578b\uff08PetType\uff09\u3002P\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/76683.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-22T17:25:25+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76683.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/76683.html\",\"name\":\"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-22T17:25:25+00:00\",\"dateModified\":\"2026-02-22T17:25:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/76683.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/76683.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76683.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/76683.html","og_locale":"zh_CN","og_type":"article","og_title":"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728\u73b0\u4ee3\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6570\u636e\u6a21\u578b\u7684\u8bbe\u8ba1\u548c\u6570\u636e\u5b8c\u6574\u6027\u7684\u7ef4\u62a4\u662f\u81f3\u5173\u91cd\u8981\u7684\u4efb\u52a1\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528Entity Framework Core\uff08EF Core\uff09\u786e\u4fdd\u6570\u636e\u6a21\u578b\u4e2d\u7684CatOwner\u548cDogOwner\u8868\u7684PetType\u5b57\u6bb5\u53ea\u80fd\u5173\u8054\u5230\u6b63\u786e\u7c7b\u578b\u7684\u5ba0\u7269\u7c7b\u578b\u3002 \u6570\u636e\u6a21\u578b\u6982\u8ff0 \u6211\u4eec\u6709\u4e00\u4e2a\u57fa\u7840\u6a21\u578bOwner\uff0c\u5b83\u901a\u8fc7PetId\u5173\u8054\u5230\u5ba0\u7269\u3002\u6839\u636e\u5ba0\u7269\u7c7b\u578b\uff0c\u6211\u4eec\u5c06\u5176\u5206\u79bb\u4e3a\u4e24\u4e2a\u5177\u4f53\u7684\u8868\uff1aCatOwner\u548cDogOwner\u3002\u8fd9\u4e24\u4e2a\u8868\u4e0d\u4ec5\u5305\u542b\u4e86\u6240\u6709\u8005\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u8fd8\u5305\u542b\u4e86\u5ba0\u7269\u7684\u7c7b\u578b\uff08PetType\uff09\u3002P","og_url":"https:\/\/www.wsisp.com\/helps\/76683.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-22T17:25:25+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/76683.html","url":"https:\/\/www.wsisp.com\/helps\/76683.html","name":"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-22T17:25:25+00:00","dateModified":"2026-02-22T17:25:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/76683.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/76683.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/76683.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u786e\u4fdd\u6570\u636e\u5b8c\u6574\u6027\u7684Entity Framework Core\u5b9e\u8df5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=76683"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76683\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=76683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=76683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=76683"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=76683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}