Ticket T539811
Visible to All Users
Duplicate

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

Core - Design-time Model Editor does not take Entity Framework class metadata into account

Web LookupListView ignores column configuration from model

created 8 years ago

Hello,
I'm using EF and have class Role that has a property Forwarder:

C#
public class Role : IXafEntityObject, IObjectSpaceLink, INotifyPropertyChanged, IHasAuditInfo { ... [StringLength(10)] [Column("forwarder_code")] public String ForwarderCode { get; set; } [ForeignKey("ForwarderCode")] public virtual Forwarder Forwarder { get; set; } ... }

When I click on the Forwarder field in the Web UI, the lookup view (args.View.ID: Forwarder_LookupListView) pops up as expected but the columns in it are different from what is defined in the model. It seems that the model for the lookup view is completly ignored.
If I apply VisibleInLookupListView(false) attribute to Forwarder's properties, they disappear from the lookup.
When I add another column to lookuplistview usin the model editor, it doesn't show up in the runtime.

What should I do to get the lookupview from model to show up in the runtime?

Thank You

Comments (3)
DevExpress Support Team 8 years ago

    Hello Radowan.

    Please verify that the Forwarder_LookupListView view is actually used for the lookup editor. A different list view can be specified in the IModelMemberViewItem.View property.
    If you are modifying the lookup list view model in the platform-agnostic module, check that it is not further customized in the platform-specific module or the application model. Also, see that the IModelListView.FreezeColumnIndices property is not set to True in higher model layers as this will suppress changes made in lower model layers.

    If this doesn't help, provide us with a sample project demonstrating the issue,

    RV RV
    Radovan Vlach 2 8 years ago

      Hello Michael,
      Thank you for your comments. I verified in the runtime debug window that Forwarder_LookupListView is used.

      I have prepared sample project.  I also included a word document with steps to reproduce.

      While I was preparing it, I discovered that the behavior of Model Editor is strange:
      When my class is decorated with [DefaultProperty("CompanyCode")] attribute, it generates different lookup view and customizations of this new view are ignored. Please see attached file for more details.

      DevExpress Support Team 8 years ago

        Thanks for the project. I see the issue. We need additional time to research it. We will get back once we have any result.

        Answers approved by DevExpress Support

        created 8 years ago (modified 8 years ago)

        Hello Radovan.

        Since the CompanyCode property is a key, it is hidden from the lookup list view by default. To show it, decorate the property with the VisibleInLookupListView(true) attribute.

        Please note that the design-time Model Editor currently cannot retrieve all specifics of business objects from the Entity Framework data model. So, the model shown at design time may look different than the actual model at runtime. We recently discussed a similar issue with you in the T531130 - DetailView renders editors for long strings in a web application even if all editors are removed in the model ticket.

        If you need to customize views corresponding to EF entities using the Model Editor at design time, you can freeze the view by setting the IModelListView.FreezeColumnIndices or IModelDetailView.FreezeLayout property to True. Then, the difference between the incomplete design-time data model and the actual runtime model won't break your customizations.

          Show previous comments (1)
          DevExpress Support Team 8 years ago

            Thank you for your feedback. We will further research the possibility to overcome this Model Editor limitation, but cannot promise an immediate improvement.

            >>>the problem is not that the layout is generated incorrectly (or destroyed) in the model editor, but that the layout designed in model editor is completly ignored by the application

            In fact, your customizations are not ignored. The xafml file contains only differences relative to the underlying model layer. Since the underlying layer is incomplete at design time, the result of applying differences is different than at runtime.

            RV RV
            Radovan Vlach 2 8 years ago

              Thank you, Michael.

              AG AG
              Alex Gn (DevExpress) 6 years ago

                With the version 18.2.6 we provided the capability to fix this issue on your side. Please refer to the Core - Design-time Model Editor does not take Entity Framework class metadata into account for more details.

                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.