Microsoft.EntityFrameworkCore:在两个表中映射实体 [英] Microsoft.EntityFrameworkCore : Map Entity in two tables

查看:329
本文介绍了Microsoft.EntityFrameworkCore:在两个表中映射实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

 我如何在两个表中映射实体。在另一项工作中,我需要将实体拆分为两个表格。

 How I Can map Entity in two tables . in another work I need to split Entity in two tables .

 谢谢,

  Ibrahim

  Ibrahim

ASk

推荐答案

您可以创建从另一个继承的实体实体。第一个实体已将属性映射到table1,第二个实体具有映射到表2的属性。当第二个实体从第一个实体继承时,它具有来自两个表的所有属性。
第一个实体可以是抽象的,因此您无法从中创建实例。这个原则称为表继承。
You can create entity which is inherited from another entity. First entity has mapped properties to table1 and second entity has properties mapped to table 2. When second entity is inherited from first entity then it has all properties from both tables. First entity can be abstract so you cannot create instance from it. This principle is known as table inheritance.


这篇关于Microsoft.EntityFrameworkCore:在两个表中映射实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆