Ticket T200742
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

EF - Use of complex types that are not registered in DbContext and have no key property

build a detail view for an organisation containing an address property

created 10 years ago (modified 10 years ago)

I am using Entity Framework.

I have an Organization business Object  that contains the following properties

public Address ShippingAddress { get; set; }
public Address BillingAddress { get; set; }

The Address class is as follows

C#
public class Address { public string Street1 { get; set; } public string Suburb { get; set; } public string State{ get; set; } public string Postcode { get; set; } public string Street2 { get; set; } }

When I create the application the generated address fields simply display the read only text
"Application.Module.BusinessObjects.Address"

How should I go about building the detail view so the address fields are visible and editable?

[Update]
I use this class with in my business object

C#
[Table("Organisations")] public class Organisation : BasicBO { public Organisation() { ShippingAddress = new Address(); Contacts = new BindingList<Contact>(); } public string Name { get; set; } public Address ShippingAddress { get; set; } }

Answers approved by DevExpress Support

created 10 years ago

Hello Kirsten,

Your data model is not properly designed as far as Entity Framework itself is concerned. I suggest you refer to public community resources, such as MSDN or StackOverFlow, to learn more on how to fix this, because this issue is unrelated to our product itself.

Alternatively, you can take another look at the XAF integration documentation at eXpressApp Framework > Concepts > Business Model Design > Data Types Supported by built-in Editors > Reference (Foreign Key, Complex Type) Properties + research the source code of the DevExpress.Persistent.BaseImpl.EF library as these places provide examples for such common tasks.

    Show previous comments (6)
    Dennis Garavsky (DevExpress) 10 years ago

      Hello Kirsten,

      Thanks for your feedback in this regard. We will take this scenario into account.

        Thanks Dennis,
        We are holding out for this in our project :-)

        Dennis Garavsky (DevExpress) 10 years ago

          You are always welcome. In the meantime, you can implement a custom PropertyEditor to work with such properties (as per my original response).

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.