不知道很少使用Schema模型还是怎么,居然搜帖子没人说,虽然很简单但是还是想记录一下坑

命名空间

using System.ComponentModel.DataAnnotations.Schema;

数据注释

[Table("blogs", Schema = "blogging")]
public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
}

因为我们项目表结构通过架构来区分的,一直都没找到ef里面怎么设置,看了很多资料但是忽略了table就有这个参数 可能table有参构造并没有这属性造成的吧

地址:https://docs.microsoft.com/zh-cn/ef/core/modeling/relational/tables

默认架构设置:https://docs.microsoft.com/zh-cn/ef/core/modeling/relational/default-schema

记录下坑希望有人踩到直接就找到了

相关文章:

  • 2022-01-27
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2020-03-22
  • 2021-09-03
猜你喜欢
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-09-23
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案