tph

ef-core load collection property of nested tph inherited member

混江龙づ霸主 提交于 2019-12-18 13:15:15
问题 Given the following class structure public class Parent { public Guid Id { get; public List<BaseChild> Children { get; set; } } public abstract class BaseChild { public int Id { get; set; } public string ChildName { get; set; } } public class NormalChild : BaseChild { public DateTime BirthDate { get; set; } } public class RichChild : BaseChild { public List<OffshoreAccount> OffshoreAccounts { get; set; } } public class OffshoreAccount { public string AccountNumber { get; set; } public

EF6 TPH mapping of derived property to specific table specific column

有些话、适合烂在心里 提交于 2019-12-13 18:41:57
问题 Have legacy DB with a Customer entity split in into 3 tables (1-1) with shared key. Wanted to use Code First TPH and map it to split tables. Here's simplified classes hierarchy (numerous primitive properties and their mappings omitted): public abstract partial class Customer { public int Id { get; set; } public bool Leasing { get; set; } public string Address { get; set; } public string Name { get; set; } } class PrivateCustomer : Customer { public string PrivateName { get; set; } } class

Conditional Mapping in Entity Framework - OR operation with TPH

假装没事ソ 提交于 2019-12-12 05:16:31
问题 We have an entity like Vehicle and three derived entities such as Car , Motorbike and Bicycle . This inheritance hierarchy is implemented with TPH . Here are entity mapping conditions: __disc__ = car for Car __disc__ = motorbike for Motorbike __disc__ = bicycle for Bicycle How can I derive another child from Vehicle like MotorVehicle with following mapping condition: __disc__ = car OR motorbike for MotorVehicle I'd view in Database like this when I had this structure with TPT : SELECT Id FROM

c#, web api, swashbuckler/swagger

两盒软妹~` 提交于 2019-12-11 10:46:29
问题 This is my first web api, first web app, and first time Ive used swagger via swashbuckler. I'm using TPH for my equipment db table. For example, I have base class called equipment with several child classes inherited from equipment. (This isnt real code so Ive not put in all the publics etc) As I sorta expect, the model description when I run swagger in my browser, just returns the model for the equipment class I've googled how to show all possible models but can't understand the replies as

Farther extending ApplicationUser class in ASP.NET MVC5 Identity system

∥☆過路亽.° 提交于 2019-12-01 01:37:19
问题 I'm creating a simple application for university where a student can make some type of request which is then processed by an employee of particular speciality. I would like to use default MVC5 identity system and to extend the ApplicationUser class using TPH pattern. So I added the common properties to the ApplicationUser: public class ApplicationUser : IdentityUser { [Required] public string FirstName { get; set; } [Required] public string LastName { get; set; } [Required] public string

ef-core load collection property of nested tph inherited member

久未见 提交于 2019-11-30 08:59:12
Given the following class structure public class Parent { public Guid Id { get; public List<BaseChild> Children { get; set; } } public abstract class BaseChild { public int Id { get; set; } public string ChildName { get; set; } } public class NormalChild : BaseChild { public DateTime BirthDate { get; set; } } public class RichChild : BaseChild { public List<OffshoreAccount> OffshoreAccounts { get; set; } } public class OffshoreAccount { public string AccountNumber { get; set; } public AccountInfo AccountInfo { get; set; } } What is the best way to query parent data to include information about