Trying to use Split Base

Trying to use Split Base

Old forum URL: forums.lhotka.net/forums/t/1463.aspx


davem1958 posted on Thursday, October 12, 2006

I'm doing a sanity check on the CSLA templates, which I downloaded yesterday.  I'm hoping to use the Split Base option, so I will have two files per CSLA object.  I'm running it against Lhotka's PTracker database, and attempting to replace the ProjectTracker.Library with the code-generated files.  So far, I have not been able to compile.  Has anyone tried this exercise?  It could be that my XML configurations aren't quite right....

The particular error is

Using the generic type 'Matchbox.Business.ProjectResourcesBase<T,C>' requires '2' type arguments C:\VSS\CSLA\ProjectTracker\ProjectTracker.Library\ProjectResourceBase.cs 207 67 ProjectTracker.Library

The code that won't compile reads

internal void Insert<P>(SqlConnection cn, P parent) where P : ProjectResourcesBase<P>

Thanks!

smark replied on Thursday, October 12, 2006

Davem,

I ran into the same situation. The DataPortal_Update in the parent is only providing one parameter (cn) to the child's insert method, but the insert method in the child expects two (cn and parent). What I did for the time being is to add the 'this' keyword in the parent's DataPortal_Update method where there is a loop to insert or update child objects. So the loop now looks like: child.Insert(cn, this) and child.Update(cn, this).

This compiles the code for me, but I am not sure if this is the solution in the overall scheme of things; I am just beginning to learn code generation.

davem1958 replied on Thursday, October 12, 2006

Similar, but I don't think it's the same problem.  My code reads

protected virtual void UpdateChildren(SqlConnection cn)

{

_resources.Update(cn, (T)this);

Are you using the latest templates (yesterday's)?

 

smark replied on Thursday, October 12, 2006

I am using the templates for CSLA 2.1 released on 4th October.

davem1958 replied on Thursday, October 12, 2006

Looks like we have the same templates.  Mine are dated 10/4, although the Zip file is dated 10/11.

Dave

rasupit replied on Friday, October 13, 2006

internal void Insert<P>(SqlConnection cn, P parent) where P : ProjectResourcesBase<P>

davem1958,

You should never define a collection object as parent. In your object graph Project is the parent of ProjectResource.

For others who are having issue when define the parent, see my other posts http://forums.lhotka.net/forums/thread/4672.aspx which explain when to use (or not to use) parent

Ricky

davem1958 replied on Monday, October 16, 2006

I figured it was operator error.  :)

Thanks!

Copyright (c) Marimer LLC