EF 6.0 - Map complex type to same table as parent property

ef-fluent-api entity-framework-6

Question

I examined the following:

First, numerous complicated kinds of the same type are mapped to a table via the entity framework code.

In light of the sample code:

[Table("TXLifeRequest", Schema = "txlife")]
public partial class TXLifeRequest
{
    public virtual OLI_LU_BOOLEAN PendingResponseOK { get; set; }
    ...
}

[Table("OLI_LU_BOOLEAN", Schema = "txlife")]
public partial class OLI_LU_BOOLEAN {

    public string tc { get; set; }

    public string Value { get; set; }
}

I want to set up the database in a way that theOLI_LU_BOOLEAN is not in a new table, rather to be two new columns in theTXLifeRequest table as similar toTXLifeRequest.PendingResponseOK_tc and PendingResponseOK _Value .

In the current environment, there is no fluent code. Is there a method to merge the tables while maintaining the class structure, using either fluent or attributes?

Update:

I tried this, but it just creates a new table.TXLifeRequest1 every one of theOLI_LU_BOOLEAN properties. How would I declare that they were the same table's properties?

modelBuilder.ComplexType<OLI_LU_BOOLEAN>()

CreateTable("imsparamed.TXLifeRequest1",
            c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    PendingResponseOK_Value = c.String(),
                    PendingResponseOK_Id = c.Int(nullable: false)

                })
1
0
9/7/2018 4:23:24 PM

Accepted Answer

ZZZ_tmp
0
9/10/2018 9:06:57 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow