Questions tagged [table-per-hierarchy]

A technique that maps an inheritance hierarchy of objects to a single table in relational database.

133 questions
0
votes
1 answer

Tell Entity Framework to use the correct name for this Foreign Key

Edit: I should probably include the Email, Address, and Phone entities: Public Class AddressEntity Inherits AddressComplexEntity Public Property AddressId() As Guid Public Sub New() AddressId =…
0
votes
0 answers

Entity Framework 4: Dynamic Proxy error on a seemingly simple query?

I have a Linq To Entities query I am making in my POCO Entity Framework application, that looks like this: var orders = stateRepository.Get() .OfType() .Where(x => x.Id == stateId) …
glenatron
  • 11,018
  • 13
  • 64
  • 112
0
votes
0 answers

Entity Framework: Is Table Per Hierarchy the right inheritance pattern for this situation?

Imagine I have a hierarchy of objects I want to store in my Entity Framework 4.1 data store. I am creating them using Code First. They look like this: BasicState has many -> StatefulEntities has a -> CreationDate ReceivedState has a ->…
glenatron
  • 11,018
  • 13
  • 64
  • 112
0
votes
2 answers

Parent Child Hierachy in asp.net

I want to show family hierachy in asp.net. I have table as Family with attributes ParentID, ChildID, Name. Table have seft join on ParentID and ChildID. How I show the data from database. The hierarchy level is not fix. #edited I want aspx part to…
user
  • 793
  • 4
  • 14
  • 23
0
votes
1 answer

Problems setting up EF5 and a Lookup Table

I'm trying to design a code-first model with a TPH Lookup Table like the following: public abstract class LookupValue { [Key] public string Value { get; set; } } public class PaymentTerm : LookupValue {} public class ShippingCode :…
scott-pascoe
  • 1,463
  • 1
  • 13
  • 31
0
votes
1 answer

SaveChanges doesn't work for TPH entities

I use Entity framework with Generate T-SQL Via T4 (TPH).xaml (VS) and SSDLToSQL10.tt (VS) templates. I have a table TABLE [dbo].[Users]( [UserId] [int] IDENTITY(1,1) NOT NULL, [UserName] [nvarchar](100) NOT NULL, [Password]…
Andrey Stukalin
  • 5,328
  • 2
  • 31
  • 50
0
votes
1 answer

Table Per Hierarchy & Inherited Relationships

I'm using Entity Framework 5, targeting .Net 4.5. For the life of me I can't figure out what I'm doing wrong that's causing the following error while trying to work with Table Per Hierarchy and Navigation columns: Invalid column name…
0
votes
1 answer

NHibernate missing SqlParameter for overriden property

I'm trying to implement table-per-hierarchy approach, using FluentNHibernate AutoMapping. I have a base class and three child classes. The third child class overrides a couple of properties of the base class. Instances of first two child classes…
0
votes
1 answer

Code First - Mapping when the Discriminator IS NULL or NOT NULL

I want to use TPH Inheritance in EF5 Code First. I want to base it on whether a column in the database is null or not. I found this link indicating it was not possible in EF4. Entity Framework 4 - TPH Inheritance in Features CTP5 (code first) with…
0
votes
0 answers

Entity Framework Table per hierarchy using TypeID both as property and condition

I'm implementing a domain tree structure using entity framework + mvc. I use JSTree to present the org structure. Note that in that model scheme i use the TypeID property both as a condition of my inheritance and as a property for…
0
votes
1 answer

EF, Table per Hierarchy, property in abstract class

I'm wondering if I can use virtual properties defines in a base class (abstract) to create a link with an other concrete type. For example : public abstract class AbstractService { public int Id {get;set;} public int? SiteId {get;set;} …
Whoami
  • 334
  • 4
  • 16
0
votes
2 answers

C#, Entity framework, TPH

I have a problem with a TPH mapping. Here are the classes : Abstract service (base class) [Table("Services")] public abstract class AbstractService : IAuditedObject { public int Id { get; set; } [DisplayName("Receiver Site")] public…
Whoami
  • 334
  • 4
  • 16
-1
votes
1 answer

Best advice to Implement REST API for entities with Table Per Hierarchy model design (MVCCore + EF 2.2)

I have a couple of derived classes Shippable and Downloadable inheriting from the same base class Product and each of them have own properties: public abstract class Product : Entity { public ProductType ProductType{ get; set;…
hitasp
  • 698
  • 2
  • 8
  • 19
1 2 3
8
9