AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

CSLA: DataPortal_Fetch compilation error on ReadOnlyList from outside Entities.csp #471

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Generate ReadOnlyRootList+ReadOnlyChild from one table with Entities.csp.
2.Now generate another ReadonlyRootList and ReadonlyChild outputs from outside 
Entities.csp with same table.

What is the expected output? What do you see instead?
When ReadOnlyRootList object retrieve its children at DataPortal_Fetch, and 
then add children retrieved to its own list, the follow line of code are 
generated:
   Me.Add(New GestionViajata.BLL.ProductMiniInfoList(reader))
Instead, the follow line should be generated:
   Me.Add(New GestionViajata.BLL.ProductMiniInfo(reader))

'ProductMiniInfoList(reader)' generate a compilation error.

What version of the product are you using?
CSLA-v3.0.0.1887

Please provide any additional information below.
What I want it to generate another copy of ReadOnlyRootList and ReadOnlyChild 
with only a few fields, not all. Then I generate another output with object 
names ProductMiniInfo and ProductMiniInfoList, and I use the OnFetching partial 
method to retrieve only my fields that I want. But the issue reported, generate 
a compilation error and I cannot continue.

I attached a small sample and database schema.

The issue is related to the ResolveTargetClassName() of the 
EntityCodeTemplate.cs from QuickStart project that don't work very fine when 
you generate outputs from outside Entities.csp.

Original issue reported on code.google.com by bernyrod...@gmail.com on 2 Aug 2010 at 9:43

Attachments:

GoogleCodeExporter commented 9 years ago
More info about that issue.

In the file CSLA\VisualBasic\Common\DataPortalFetchList.ParameterizedSQL.cst
we have the follow line of code:
Me.Add(New <%= BusinessProjectName %>.<%= 
ResolveTargetClassName(ChildBusinessClassName, "Info", 
BusinessClassName.Contains("InfoList") AndAlso 
IsReadOnlyBusinessObject("Info")) %>(reader))

The only difference that I found when it is called from inside or from outside 
of Entities.csp is follow:

Call from inside for object named ProductInfoList:
-------------------------------------------------
ChildBusinessClassName:Product
BusinessClassName:ProductInfoList

Call from outside for object named ProductMiniInfoList:
------------------------------------------------------
ChildBusinessClassName:ProductMiniInfoList
BusinessClassName:ProductMiniInfoList

Then, the issue is more related to the resolution of the ChildBusinessClassName 
property when it is used from in/out Entities.csp.

Original comment by bernyrod...@gmail.com on 2 Aug 2010 at 10:29

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 2 Aug 2010 at 9:11

GoogleCodeExporter commented 9 years ago
Hello,

I'll take a look into this and see if I can find a solution.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 17 Aug 2010 at 10:34

GoogleCodeExporter commented 9 years ago
Hello,

I have added a child business class name property that resolves this.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 24 Aug 2010 at 6:40