(21)ASP.NET Core EF創建模型(關係)

来源:https://www.cnblogs.com/wzk153/archive/2019/10/24/11730933.html
-Advertisement-
Play Games

1.關係 關係定義兩個實體之間的關係。在關係型資料庫中,這由外鍵約束表示。 2.術語定義 有許多術語用於描述關係:●相關實體:這是包含外鍵屬性的實體。有時稱為關係的"子級"。●主體實體:這是包含主/備用鍵屬性的實體。有時稱為關係的 "父項"。●外鍵:依賴實體中的屬性,用於存儲與實體相關的主體鍵屬性的 ...


1.關係

關係定義兩個實體之間的關係。在關係型資料庫中,這由外鍵約束表示。

2.術語定義

有許多術語用於描述關係:
●相關實體:這是包含外鍵屬性的實體。有時稱為關係的"子級"。
●主體實體:這是包含主/備用鍵屬性的實體。有時稱為關係的 "父項"。
●外鍵:依賴實體中的屬性,用於存儲與實體相關的主體鍵屬性的值。
●主體密鑰:唯一標識主體實體的屬性。這可能是主鍵或備用密鑰。
●導航屬性:在主體和/或從屬實體上定義的屬性,該屬性包含對相關實體的引用。
●集合導航屬性:一個導航屬性,其中包含對多個相關實體的引用。
●引用導航屬性:保存對單個相關實體的引用的導航屬性。
●反嚮導航屬性:討論特定導航屬性時,此術語是指關係另一端的導航屬性。
下麵的代碼列表顯示了與之間Blog的一對多關係Post
●Post是依賴實體
●Blog是主體實體
●Post.BlogId為外鍵
●Blog.BlogId是主體鍵(在這種情況下是主鍵,而不是備用鍵)
●Post.Blog是一個引用導航屬性
●Blog.Posts是集合導航屬性
●Post.Blog是的Blog.Posts反嚮導航屬性(反之亦然)

public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }
    public int BlogId { get; set; }
    public Blog Blog { get; set; }
}

3.約定

按照約定,當發現類型上有導航屬性時,將創建關係。如果屬性指向的類型不能由當前的資料庫提供程式映射為標量類型,則該屬性視為一個導航屬性。

4.完全定義的關係

關係最常見的模式是在關係兩端定義導航屬性,在依賴實體類中定義外鍵屬性。
如果在兩個類型之間找到一對導航屬性,則這些屬性將配置為同一關係的反嚮導航屬性。
如果依賴實體包含名為<primary key property name>、<navigation property name><primary key property name>或<principal entity name><primary key property name>的屬性,則該屬性將被配置為外鍵。

public class Blog
{
    public int BlogId { get; set; }
 public string Url { get; set; }
    //導航屬性
    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }
    //外鍵屬性
    public int BlogId { get; set; }
    //反嚮導航屬性
    public Blog Blog { get; set; }
}

5.無外鍵屬性

儘管建議在依賴實體類中定義外鍵屬性,但這並不是必需的。如果未找到外鍵屬性,則會以該名稱<navigation property name><principal key property name>引入陰影外鍵屬性。

public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
    //陰影導航屬性
    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }
     //陰影反嚮導航屬性
    public Blog Blog { get; set; }
}

6.單個導航屬性

只包含一個導航屬性(無反嚮導航,沒有外鍵屬性)就足以具有約定定義的關係。 還可以有一個導航屬性和一個外鍵屬性。

public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
    //陰影導航屬性
    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }
}

7.數據註釋

可以使用兩個數據批註來配置關係[ForeignKey]和[InverseProperty]。System.ComponentModel.DataAnnotations.Schema命名空間中提供了這些項。

7.1ForeignKey

你可以使用數據批註來配置應用程式作給定關係的外鍵屬性的屬性。通常,當不按約定發現外鍵屬性時,會執行此操作。

namespace EFModeling.DataAnnotations.Relationships.ForeignKey
{
    class MyContext : DbContext
    {
        public DbSet<Blog> Blogs { get; set; }
        public DbSet<Post> Posts { get; set; }
    }
    #region Entities
    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
        //導航屬性
        public List<Post> Posts { get; set; }
    }
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        //外鍵
        public int BlogForeignKey { get; set; }
        //設置反嚮導航外鍵
        [ForeignKey("BlogForeignKey")]
        public Blog Blog { get; set; }
    }
    #endregion
}

7.2InverseProperty

您可以使用數據批註來配置依賴項和主體實體上的導航屬性如何配對。這通常在兩個實體類型之間存在多個導航屬性對時執行。

namespace EFModeling.DataAnnotations.Relationships.InverseProperty
{
    class MyContext : DbContext
    {
        public DbSet<Post> Posts { get; set; }
        public DbSet<User> Users { get; set; }
    }
    #region Entities
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }

        public int AuthorUserId { get; set; }
        public User Author { get; set; }

        public int ContributorUserId { get; set; }
        public User Contributor { get; set; }
    }
    public class User
    {
        public string UserId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        
        [InverseProperty("Author")]
        public List<Post> AuthoredPosts { get; set; }
       
        [InverseProperty("Contributor")]
        public List<Post> ContributedToPosts { get; set; }
    }
    #endregion
}

8.Fluent API

若要在熟知的API中配置關係,請首先標識構成關係的導航屬性。HasOne或HasMany標識要開始配置的實體類型上的導航屬性。然後,將調用鏈接到WithOne或WithMany以標識反嚮導航。HasOne/WithOne用於引用導航屬性,HasMany / WithMany用於集合導航屬性。

namespace EFModeling.FluentAPI.Relationships.NoForeignKey
{
    #region Model
    class MyContext : DbContext
    {
        public DbSet<Blog> Blogs { get; set; }
        public DbSet<Post> Posts { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Post>()
                //配置一對多關係
                .HasOne(p => p.Blog)
                .WithMany(b => b.Posts);
        }
    }
    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
        public List<Post> Posts { get; set; }
    }
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        public Blog Blog { get; set; }
    }
    #endregion
}

8.1單個導航屬性

如果只有一個導航屬性,則用WithOne、WithMany的無參數重載。這表示在概念上,關係的另一端有一個引用或集合,但實體類中不包含導航屬性。

namespace EFModeling.FluentAPI.Relationships.OneNavigation
{
    #region Model
    class MyContext : DbContext
    {
        public DbSet<Blog> Blogs { get; set; }
        public DbSet<Post> Posts { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Blog>()
                //配置多對一關係
                .HasMany(b => b.Posts)
                .WithOne();
        }
    }
    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
        //導航屬性
        public List<Post> Posts { get; set; }
    }
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
    }
    #endregion
}

8.2ForeignKey

你可以使用API來配置應用程式的外鍵屬性。

namespace EFModeling.Configuring.DataAnnotations.Samples.Relationships.ForeignKey
{
    #region Model
    class MyContext : DbContext
    {
        public DbSet<Blog> Blogs { get; set; }
        public DbSet<Post> Posts { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Post>()
                //配置一對多關係
                .HasOne(p => p.Blog)
                .WithMany(b => b.Posts)
                //配置外鍵
                .HasForeignKey(p => p.BlogForeignKey);
        }
    }
    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
        //導航屬性
        public List<Post> Posts { get; set; }
    }
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        //外鍵
        public int BlogForeignKey { get; set; }
        public Blog Blog { get; set; }
    }
    #endregion
}

下麵的代碼列表演示如何配置複合外鍵:

namespace EFModeling.Configuring.DataAnnotations.Samples.Relationships.CompositeForeignKey
{
    #region Model
    class MyContext : DbContext
    {
        public DbSet<Car> Cars { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Car>()
                //配置複合主鍵
                .HasKey(c => new { c.State, c.LicensePlate });
                modelBuilder.Entity<RecordOfSale>()
                //配置一對多關係
                .HasOne(s => s.Car)
                .WithMany(c => c.SaleHistory)
                //配置外鍵
                .HasForeignKey(s => new { s.CarState, s.CarLicensePlate });
        }
    }
    public class Car
    {
        public string State { get; set; }
        public string LicensePlate { get; set; }
        public string Make { get; set; }
        public string Model { get; set; }
        //導航屬性
        public List<RecordOfSale> SaleHistory { get; set; }
    }
    public class RecordOfSale
    {
        public int RecordOfSaleId { get; set; }
        public DateTime DateSold { get; set; }
        public decimal Price { get; set; }
        //State對應CarState
        public string CarState { get; set; }
        //LicensePlate 對應CarLicensePlate
        public string CarLicensePlate { get; set; }
        public Car Car { get; set; }
    }
    #endregion
}

您可以使用的HasForeignKey(...)字元串重載將影子屬性配置為外鍵。建議先將影子屬性顯式添加到模型,然後再將其用作外鍵:

class MyContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }
    public DbSet<Post> Posts { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // Add the shadow property to the model
        modelBuilder.Entity<Post>()
             //配置外鍵
            .Property<int>("BlogForeignKey");
        // Use the shadow property as a foreign key
        modelBuilder.Entity<Post>()
            //配置一對多關係
            .HasOne(p => p.Blog)
            .WithMany(b => b.Posts)
            //配置外鍵
            .HasForeignKey("BlogForeignKey");
    }
}
public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }
    public Blog Blog { get; set; }
}

8.3無導航屬性

不一定需要提供導航屬性。你可以直接在關係的一端提供外鍵。

namespace EFModeling.FluentAPI.Relationships.NoNavigation
{
    #region Model
    class MyContext : DbContext
    {
        public DbSet<Blog> Blogs { get; set; }
        public DbSet<Post> Posts { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Post>()
                //配置一對多關係
                .HasOne<Blog>()
                .WithMany()
                //配置外鍵
                .HasForeignKey(p => p.BlogId);
        }
    }
    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
    }
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        public int BlogId { get; set; }
    }
    #endregion
}

9.主體密鑰

如果你希望外鍵引用主鍵之外的屬性,則可以使用熟知的API來配置關係的主體鍵屬性。 配置為主體密鑰的屬性將自動設置為備用密鑰。

class MyContext : DbContext
{
    public DbSet<Car> Cars { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<RecordOfSale>()
            .HasOne(s => s.Car)
            .WithMany(c => c.SaleHistory)
            .HasForeignKey(s => s.CarLicensePlate)
            .HasPrincipalKey(c => c.LicensePlate);
    }
}
public class Car
{
    public int CarId { get; set; }
    public string LicensePlate { get; set; }
    public string Make { get; set; }
    public string Model { get; set; }

    public List<RecordOfSale> SaleHistory { get; set; }
}
public class RecordOfSale
{
    public int RecordOfSaleId { get; set; }
    public DateTime DateSold { get; set; }
    public decimal Price { get; set; }

    public string CarLicensePlate { get; set; }
    public Car Car { get; set; }
}

下麵的代碼列表演示如何配置複合主體鍵:

class MyContext : DbContext
{
    public DbSet<Car> Cars { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<RecordOfSale>()
            .HasOne(s => s.Car)
            .WithMany(c => c.SaleHistory)
            .HasForeignKey(s => new { s.CarState, s.CarLicensePlate })
            .HasPrincipalKey(c => new { c.State, c.LicensePlate });
    }
}
public class Car
{
    public int CarId { get; set; }
    public string State { get; set; }
    public string LicensePlate { get; set; }
    public string Make { get; set; }
    public string Model { get; set; }

    public List<RecordOfSale> SaleHistory { get; set; }
}
public class RecordOfSale
{
    public int RecordOfSaleId { get; set; }
    public DateTime DateSold { get; set; }
    public decimal Price { get; set; }

    public string CarState { get; set; }
    public string CarLicensePlate { get; set; }
    public Car Car { get; set; }
}

10.必需和可選的關係

您可以使用熟知的API來配置是必需的還是可選的關係。最終,這會控制外鍵屬性是必需的還是可選的。當使用陰影狀態外鍵時,這非常有用。如果實體類中具有外鍵屬性,則關係的requiredness取決於外鍵屬性是必需還是可選。

class MyContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }
    public DbSet<Post> Posts { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Post>()
            .HasOne(p => p.Blog)
            .WithMany(b => b.Posts)
            .IsRequired();
    }
}
public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }

    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }

    public Blog Blog { get; set; }
}

11.級聯刪除

您可以使用熟知的API顯式配置給定關係的級聯刪除行為。

class MyContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }
    public DbSet<Post> Posts { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Post>()
            .HasOne(p => p.Blog)
            .WithMany(b => b.Posts)
            .OnDelete(DeleteBehavior.Cascade);
    }
}
public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }

    public List<Post> Posts { get; set; }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }

    public int? BlogId { get; set; }
    public Blog Blog { get; set; }
}

12.其他關係模式

12.1一對一

一對多關係在兩側都有一個引用導航屬性。它們遵循與一對多關係相同的約定,但在外鍵屬性上引入了唯一索引,以確保只有一個依賴項與每個主體相關。

12.1.1數據註釋
public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }

    public BlogImage BlogImage { get; set; }
}
public class BlogImage
{
    public int BlogImageId { get; set; }
    public byte[] Image { get; set; }
    public string Caption { get; set; }

    public int BlogId { get; set; }
    public Blog Blog { get; set; }
}
12.1.2Fluent API

使用API 配置關係時,請使用HasOne和WithOne方法。配置外鍵時,需要指定依賴實體類型,請註意以下列表HasForeignKey中提供的泛型參數。在一對多關係中,可以清楚地表明具有引用導航的實體是依賴項,並且具有集合的實體是主體。但這並不是一對一的關係,因此需要顯式定義它。

class MyContext : DbContext
{
    public DbSet<Blog> Blogs { get; set; }
    public DbSet<BlogImage> BlogImages { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blog>()
            .HasOne(p => p.BlogImage)
            .WithOne(i => i.Blog)
            .HasForeignKey<BlogImage>(b => b.BlogForeignKey);
    }
}
public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }

    public BlogImage BlogImage { get; set; }
}
public class BlogImage
{
    public int BlogImageId { get; set; }
    public byte[] Image { get; set; }
    public string Caption { get; set; }

    public int BlogForeignKey { get; set; }
    public Blog Blog { get; set; }
}

12.2多對多

目前尚不支持多對多關係,沒有實體類來表示聯接表。但是,您可以通過包含聯接表的實體類並映射兩個不同的一對多關係,來表示多對多關係。

class MyContext : DbContext
{
    public DbSet<Post> Posts { get; set; }
    public DbSet<Tag> Tags { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<PostTag>()
            .HasKey(pt => new { pt.PostId, pt.TagId });
        modelBuilder.Entity<PostTag>()
            .HasOne(pt => pt.Post)
            .WithMany(p => p.PostTags)
            .HasForeignKey(pt => pt.PostId);
        modelBuilder.Entity<PostTag>()
            .HasOne(pt => pt.Tag)
            .WithMany(t => t.PostTags)
            .HasForeignKey(pt => pt.TagId);
    }
}
public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }

    public List<PostTag> PostTags { get; set; }
}
public class Tag
{
    public string TagId { 	   

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • var begin_daily = from a in _postgreDbContext.tab1 join b in _postgreDbContext.tab2 on a.id equals b.merchant_id into a_left ... ...
  • 場景 在新建一個Winform窗體後,拖拽控制項設置其佈局如下 如果只是單純的這麼設計,我們在運行後,如果對視窗進行縮放就會導致如下 所以我們需要在設計頁面佈局時對控制項進行定位設置。 註: 博客主頁:https://blog.csdn.net/badao_liumang_qizhi關註公眾號霸道的程式 ...
  • 小弟不C才,最近看了下網上的jwt方案,於是自己寫了一個簡單的jwt方案和大家分享下,希望大家給點意見! 假如有一個讀書網站,可以不用登陸就訪問,當需要自己寫文章的時候就必須登錄,並且登錄之後如果一段時間內沒有訪問,則過期了需要重新登錄。有效期內有登錄則自動續期,所以我想使用中間件來負責token的 ...
  • PDF是當今最流行的文檔格式之一,各種應用程式將其用作最終輸出。由於支持多種數據類型和可移植性,因此它是創建和共用內容的首選格式。作為對開發文檔管理應用程式感興趣的.NET應用程式開發人員,可能希望嵌入處理功能,以讀取PDF文檔並將其轉換為其他文件格式,例如HTML。 下麵,來探索並演示一下Aspo ...
  • CefSharp編譯後,在直接點擊打開CefSharp.Wpf.Example.exe,啟動沒問題但是複製demo包到其它路徑下,無法打開demo。原因:代碼中含有相對路徑下的資源文件引用。 CefSharp.Example中文件BrowserProcessHandler.cs CefSharp.E ...
  • 背景: 因編程的基礎差,因此最近開始鞏固學習C#基礎,後期把自己學習的東西,總結相應文章中,有不足處請大家多多指教。 1. 簡介 運算符是一種告訴編譯器執行特定的數學或邏輯操作的符號。C# 有豐富的內置運算符,分類如下: 算術運算符 關係運算符 邏輯運算符 複合賦值運算符 位運算符 其他運算符 本文 ...
  • 在CefSharp75版本,使用了WpfImeKeyboardHandler支持後,無法支持搜狗中文輸入法 其中的一個修複方案: 在ChrominumWebBrowser中,添加焦點事件的重寫,對InputMethod相關進行修改 SetIsInputMethodEnabled -- 是否可輸入中文 ...
  • /// <summary> /// 生成文件的 /// </summary> /// <param name="calssName"></param> public void create(string calssName) { //獲取程式集 var createClass = Assembly. ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...