Mapping of multiple nested Complex Type properties

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
BlackDice
Posts: 2
Joined: Sat 06 Jun 2020 16:23

Mapping of multiple nested Complex Type properties

Post by BlackDice » Sat 06 Jun 2020 16:55

Good afternoon!
I encountered a problem when using Entity Developer version 6.7.965 to work with EF Core 3.0 on the .NET Framework (using the Model-First approach)
The problem is this:
I have a complex type AddressPart containing two fields: Name and TypeName.
I also have one more complex type Address, which contains several fields of type AddressPart: City, Street, House.
I am adding the InvoiceAddress property of the Address complex type to the Invoice entity.

The result is the following class diagram:
  • Invoice
    • InvoiceAddress
      • City
        • Name
          TypeName
      • Street
        • Name
          TypeName
      • House
        • Name
          TypeName

The problem arises at the stage of mapping the properties of a nested complex type to columns in the database.

I use the following settings to map complex type properties:

%parent property name%_%property name%

Thus, I expect the column names to be formed as follows:
  • Invoice
    • InvoiceAddress
      • City
        • Name - InvoiceAddress_City_Name
          TypeName - InvoiceAddress_City_TypeName
      • Street
        • Name - InvoiceAddress_Street_Name
          TypeName - InvoiceAddress_Street_TypeName
      • House
        • Name - InvoiceAddress_House_Name
          TypeName - InvoiceAddress_House_TypeName
However, I get the following result:
  • Invoice
    • InvoiceAddress
      • City
        • Name - InvoiceAddress_Name
          TypeName - InvoiceAddress_TypeName
      • Street
        • Name - InvoiceAddress_Name
          TypeName - InvoiceAddress_TypeName
      • House
        • Name - InvoiceAddress_Name
          TypeName - InvoiceAddress_TypeName

Thus, I get many errors saying that different properties use the same column in the database.
The problem can be solved by writing a mapping for each field manually at the level of a specific entity, however, there are a lot of entities using this complex type.
The question is, is there a way to adjust mapping at the level of the complex type or model settings so that it is not necessary to manually configure this at the level of each entity?
I tried to configure the mapping on the level of City, Street and House properties, however the mapping settings overwrite each other.
I also tried to find the similarity of the keyword %parent property name% for the complex type, but apparently it does not exist

Shalex
Site Admin
Posts: 9302
Joined: Thu 14 Aug 2008 12:44

Re: Mapping of multiple nested Complex Type properties

Post by Shalex » Mon 15 Jun 2020 17:44

Thank you for your report. We will investigate the question and notify you about the result.

ruda
Posts: 5
Joined: Sat 29 Mar 2014 17:10

Re: Mapping of multiple nested Complex Type properties

Post by ruda » Mon 19 Apr 2021 23:02

Same problem.
And it also occurs when you have multiple ComplexType (the same), it ends up choosing the wrong one.

Shalex
Site Admin
Posts: 9302
Joined: Thu 14 Aug 2008 12:44

Re: Mapping of multiple nested Complex Type properties

Post by Shalex » Mon 26 Apr 2021 13:16

We are working on the issue and will notify you when it is fixed.

Post Reply