user2153675
user2153675

Reputation: 103

Entitiy Framework Complex Types

Is it possible to nest EF compex types and use in a domain entity ?

If it is possible what kind of configuration is necesary for complex type parent and complex type child ?

ComplexType Parent
{
 public ComplexTypeChild { get; set;}
 //other properties
}

ComplexTypeChild
{
 public string Name{ get; set;}
 //other properties
}

DomainEntity
{
 public ParentComplexType {get; private set; }
 //other properties and method
 }

Thank you in advance!

Upvotes: 0

Views: 64

Answers (1)

Jonathan Magnan
Jonathan Magnan

Reputation: 11327

Yes, it's possible.

Here is the configuration you need to add in the OnModelCreating event.

protected override void OnModelCreating(DbModelBuilder mb)
{
    mb.ComplexType<ComplexType>();
    mb.ComplexType<ComplexTypeChild>();
}

Upvotes: 1

Related Questions