2.0.2 Templates changes (??)

2.0.2 Templates changes (??)

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


lukky posted on Sunday, June 25, 2006

Hi,

I'm currently working on a set of VS.NET 2005 item templates based on the Templates provided with CSLA.NET 2.0.1.

Were there any changes made to those templates in between 2.0.1 and 2.0.2 ?

Once this is completed, I'll submit those item templates so we can have a basic code generation for CSLA 2.0 business objects directly in VS.NET.

Thank you.

Bill replied on Sunday, June 25, 2006

There is a possible breaking change when moving to 2.0.2.  It has to do with missing criteria object on the DataPortal.Create method.  Read about it in Rocky's change log at: http://www.lhotka.net/Articles.aspx?id=f32a3736-88ba-40e4-8453-8607750925a9

Are your templates for C# or VB?

lukky replied on Sunday, June 25, 2006

Yes, I have read the ChangeLog, but I'm not sure this will impact the Templates provided with the CSLA source code. I was hoping Rocky would give me feedback on this.

For the moment, I only worked on the C# templates, but I could easily do the VB ones in the next step.

What I'm working on will also include a DLL that needs to be added to the GAC (as far as I understand it) because I need to get more input from the user than just the BO type in the cases of Lists templates. I prompt the user for the Child Item class name.

Does having to install a DLL to the GAC represent a problem for most users ? If so, does anyone know of a way to implement IWizard in a DLL without placing it in the GAC ?

Regards,

jstevens replied on Friday, July 07, 2006

Lukky,

How close are you to having the VB templates done?  I desperately need those...

Thanx!

lukky replied on Friday, July 07, 2006

Hi,

I'm sorry, I've been out of town for a week, and busy as hell.

I've had to put this on ice for a while, as I'm still trying to get a good understanding of the framework in order for those templates to be really usefull (I'm reading through the book the second time, so stuff is starting to sink in).

In any case, all the templates will do is replace the actual classname for your own, so you can still achieve the same result by doing a carefull search/replace. I will try to make my templates a bit more usefull.

I really need to get a good grasp on BOs, cause I have some projects coming up, and would really like to start using the framework :-)

Regards,

kids_pro replied on Sunday, June 25, 2006

Bill:

It has to do with missing criteria object on the DataPortal.Create method.



I tried to do Fetching without criteria in ReadOnly object and it not possible.
But for Editable it works as change log.


      
    My factory method:
    public static SongList GetSongList() {
            return DataPortal.Fetch<SongList>(); // this one provide error message as show above.
            //return DataPortal.Fetch<SongList>(new EmptyCriteria()); // this one work
     }

    My Data Access Method
    private void DataPortal_Fetch() {
         Fetch("");
    }

RockfordLhotka replied on Monday, June 26, 2006

In that case, yes, a change to the templates would be required. The templates don't show how to call DataPortal.Fetch() with no parameter, because that wasn't possible before. To call DataPortal.Fetch() with no parameter (or with a parameter of Nothing/null) you need a DataPortal_Fetch() like this:

Protected Overrides Sub DataPortal_Fetch(ByVal criteria As Object)

protected override void DataPortal_Fetch(object criteria)

The criteria parameter will always come through as Nothing/null of course, but this is the method signature that will be called in this case.

In retrospect, had I done this before publishing the book, I'd probably make DataPortal.Fetch<blah>() call a DataPortal_Fetch() method that accepts NO parameters at all, but to do that now would be a big breaking change.

Not breaking to Fetch() of course, but to Create(), because they both follow the same code path to find and invoke the right method. Although I broke one Create() scenario, I left the more common one unbroken by doing the change as I did...

Copyright (c) Marimer LLC