DevXPress Report Designer with EntityCollection

Posts   
 
    
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 30-Jul-2008 05:03:54   

Hi,

I'm trying to create a report with the devexpress report designer. I've dragged an EntityCollection in. If i set the EntityFactory to one particular entity factory (and then close an re-open the designer) I get this painfully ambiguous error message:

"No parameterless constructor defined for this object."

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at SD.LLBLGen.Pro.ORMSupportClasses.EntityViewBase`1.GetItemProperties(PropertyDescriptor[] listAccessors) at DevExpress.Data.Browsing.ListBrowser.GetItemProperties(ArrayList dataSources, PropertyDescriptorCollection listAccessors) at DevExpress.Data.Browsing.RelatedListBrowser.GetItemProperties(ArrayList dataSources, PropertyDescriptorCollection listAccessors) at DevExpress.Data.Browsing.RelatedListBrowser.GetItemProperties() at DevExpress.XtraReports.Native.Data.CustomRelatedListBrowser.GetItemProperties() at DevExpress.Data.Browsing.DataContext.GetListItemProperties(Object dataSource, String dataMember) at DevExpress.Data.Browsing.Design.PickManager.GetListItemProperties(Object dataSource, String dataMember) at DevExpress.Data.Browsing.Design.PickManager.CanExpand(Object dataSource, INode node) at DevExpress.Data.Browsing.Design.PickManager.AddChildNode(IList nodes, Object dataSource, String dataMember, String displayName, Boolean isList, Object owner, PropertyDescriptor property) at DevExpress.Data.Browsing.Design.PickManager.GetSortedNodes(SortedList properties, Object dataSource, String dataMember, Object owner) at DevExpress.Data.Browsing.Design.PickManager.FillNodesCore(Object dataSource, IList nodes, DataContext dataContext) at DevExpress.Data.Browsing.Design.PickManager.FillNodes(Object dataSource, IList nodes, IDataContextService dataContextService) at DevExpress.Data.Browsing.Design.PickManager.FillContentCore(IList nodes, Object dataSource, IServiceProvider serviceProvider) at DevExpress.Data.Browsing.Design.PickManager.FillContent(IList nodes, ICollection dataSources, Boolean addNoneNode, IServiceProvider serviceProvider) at DevExpress.XtraReports.Native.TreeListPickManager.FillContent(IList nodes, ICollection dataSources, Boolean addNoneNode, IServiceProvider serviceProvider) at DevExpress.XtraReports.Design.FieldListTreeView.UpdateDataSource(IDesignerHost designerHost) at DevExpress.XtraReports.Design.FieldListController.UpdateDataSource(IDesignerHost host) at DevExpress.XtraReports.Design.FieldListController.UpdateDataSource() at DevExpress.XtraReports.Design.ReportFieldListItem.UpdateView() at DevExpress.XtraReports.Design.ReportToolShell.UpdateToolItems() at DevExpress.XtraReports.Design.ReportDesigner.OnLoadComplete(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.ComponentModel.Design.DesignerHost.OnLoadComplete(EventArgs e) at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.Serialization. IDesignerLoaderHost.EndLoad(String rootClassName, Boolean successful, ICollection errorCollection) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.OnEndLoad(Boolean successful, ICollection errors) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.OnEndLoad(Boolean successful, ICollection errors) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.System.ComponentModel. Design.Serialization.IDesignerLoaderService.DependentLoadComplete(Boolean successful, ICollection errorCollection) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) at System.ComponentModel.Design.DesignerHost.BeginLoad(DesignerLoader loader)

Which means nothing at all to me... any ideas?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Jul-2008 06:03:15   

Hi Sam, try this and if the problem persists, please post:

David Elizondo | LLBLGen Support Team
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 30-Jul-2008 06:59:03   

Hi Daelmo,

I didn't see any useful suggestions at that link you posted, apart from removing an re-adding the entitycollection which didn't help, I'm sure manually doing databinding would work just fine but I need to use the designer. I'm trying to teach a newby how to do it and I need to go slow, can't have her hand coding a hundred lines of databinding foo on her first day! smile

Error only occurs when entitycollection targets a specific entityfactory. Some work some dont.

It's a designtime error. My collection/entity/factory is all custom-ness free. I'm running DevXpress 8.2.1 and LLBL 2.6.8.613

Actually I do have one custom thing, a custom preset which basically merges the generic and db specific project together (adapter pattern).

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 30-Jul-2008 11:20:15   

The exception occurs at this line:

                else
                {
                    dummyInstance = (IEntityCore)Activator.CreateInstance( typeAttribute.TypeContainedInCollection );
                }

which is run when a related property is traversed (e.g. CustomerEntity.Orders) and it has to determine the properties of the entity of the type INSIDE the collection returned by the property. that's stored in an attribute on top of the property (in CustomerEntity.Orders, it's 'OrderEntity'), and it tries to create an instance of that type. It fails to do so if the type is an abstract entity. It needs the instance to be able to produce all the properties.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39897
Joined: 17-Aug-2003
# Posted on: 30-Jul-2008 13:26:59   

I'll look into the process once more, to see if it can deal with just the type. Previous attempts to make this a type-only process failed.

Frans Bouma | Lead developer LLBLGen Pro
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 31-Jul-2008 04:11:00   

That's ok I'll just remove the abstract flag from the class which I guess will solve my immediate problem.

Now I'm getting an error when I right click on the entityCollection and choose Set Entity Factory To Use rage I seem to going backwards as this was working yesterday.

Error msg is:

Unable to cast object of type 'Shivam.Horsell.Quotation.DAL.HelperClasses.EntityCollection' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollection2'.

This error pops as soons as I click "Set Entity..." from the context menu. I never even see the dialog that prompts for the factory... might try rebooting cry

worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 31-Jul-2008 04:14:31   

Well that was weird, did a forced "Rebuild" and it started working. Problem solved, thanks once again guys.