Ticket Q265944
Visible to All Users

XtraReports Entity Framework ObjectDataSource Designer Field List Missing Properties

created 15 years ago

I have the most bizarre problem.
I have a report in XtraReports that uses an ObjectDataSource that points to an Entity Framework entity.
In Field List I can see all the properties of the entity, I can put them in the report, it all works fine.
However I added a new custom string property to the entity class, and I did so in its partial class.
After I compiled I did not see the new property in the Field List. I tried everything to make it appear in the list…
Finally I put the new property in the designer (designer class file created by Entity Framework instead of the other file in the partial class). The property immediately appeared in the Field List.
I have noticed this behavior for all my entities. They all are partial classes, and have two files, one being the single designer file created by Entity Framework, and the other being a blank file where I add custom properties. Any property defined in the blank file will not ever appear in the Field List, and any property defined in the designer file will appear in the Field List. (Including if a just copy-paste a property into the designer file, it will appear.) All properties are defined correctly and I happily use them from other places of the project at design time and run time.
As ObjectDataSource works with the compiled assembly (new properties will not show up until you compile) I can not even imagine how it is possible that if you have a partial class and define a property in file A, it works, but if you define it in file B, it doesn't work. And only in my reports.
I have no clues about this and will be happy to hear from you.
Regards,
Lazar

Comments (1)

    And here's a sample project.
    You have ProductDescription1 defined in partial class and it is not visible in the Field List, and ProductDescription2 defined in the designer file of the same class and it is visible in the Field List.

    Answers approved by DevExpress Support

    created 15 years ago (modified 13 years ago)

    Hi Georgi,
    Thanks for posting your example. I'm afraid your approach isn't really appropriate. You shouldn't modify the Designer-generated code and include additional fields by hand. In addition, note that additional attributes are applied to other ServiceOrderProduct members. So, the plain property definition isn't enough to include a new property in your business model. I suggest that you modify the DataContext schema in Design mode. This way, everything should work fine.
    Thanks,
    Alex

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

        Hi Lazar,
        I suggest that you create a calculated field at the report's level, and then specify the required expression there (e.g. GetTimeOfDay(Now())). For complex scenarios, handle the CalculatedField.GetValue event, and then calculate the value in your code. Try this approach, and let me know whether this helps.
        Thanks,
        Alex

          Hi,
          I know, this is an old thread, but four years later, I have the same issue. Properties added to an EF-Class in the another partial-part are not shown in the field-list which is pitty indeed. I have added a lot of functionality in the partial-class to enhance the business-class created by EF and now have to duplicate the code in order to use it in the reports?
          There should be way to access those properties… (I hope I just haven't found it…). Can you shed some light on this?
          Cheers,
          Pascal

          DevExpress Support Team 11 years ago

            Hello Pascal,
            Would you please create a new ticket and provide us with a small sample illustrating your issue in action. We will examine it and do our best to find a solution for you.

            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.