Making DTO Embedded Types Shared between dto classes

Posts   
 
    
TopDog74
User
Posts: 40
Joined: 27-Apr-2012
# Posted on: 02-Nov-2016 14:58:20   

Hi,

On version 5.0.7 i am generating DTOs in my Derived Model.

Imagine i have a DtoClass 'Blah' with a property 'Port' with fields 'PortId' and 'PortName'. Using the designer this will create an embedded type like so:


namespace BlahDtoTypes
    {
        
        /// <summary> DTO class which is derived from the entity 'Port (Port)'.</summary>
        [Serializable]
        [DataContract]
        public partial class Port
        {
            /// <summary>Gets or sets the PortId field. Derived from Entity Model Field 'Port.PrtId'</summary>
            [DataMember]
            public System.String PortId { get; set; }
            /// <summary>Gets or sets the PortName field. Derived from Entity Model Field 'Port.PrtName'</summary>
            [DataMember]
            public System.String PortName { get; set; }
        }

Imagine if i had already created a 'Port' dto in the derived model. Is there a way i can force the generated dto class for my 'BlahDto' to use my 'Port' dto for the property instead of the embedded property?

Cheers, Iain

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Nov-2016 23:57:30   

That's not how DTOs are designed, as they are just projections which can be different from one root to another.

ref: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=23860&StartAtMessage=0&#135424