Code Monkey home page Code Monkey logo

Comments (1)

KVM-Explorer avatar KVM-Explorer commented on May 30, 2024

在6.4.7中我测试可以支持EF的TPT模式,也就是Company建表子表外键指向Company分别建立Manager和Worker,只需要在基类指定下Table的名称,并且在子类也指定Table名称就可以实现继承关系,然后DataContext分别构建DbSet。
如果只是抽象类而不需要建表的的话,指定Table一致或者不填写的话应该默认采用TPH模式,子类和父类在同一张表,可以参考看看FrameworkUser的实现过程

[Table("SpaceBasics")]
public class SpaceBasic : BasePoco
{
      [Display(Name = "名称")]
      public string Name { get; set; }
}
[Table("Seats")]
public class Seat : SpaceBasic
{
    
    
}
public DbSet<SpaceBasic> SpaceBasics { get; set; }
public DbSet<Seat> Seats { get; set; }
public DbSet<Area> Areas { get; set; }

from wtm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.