New version, CSLA35 - huge improvement loading DBs - Plugins - Better rules

16 views
Skip to first unread message

Andrés Villanueva

unread,
May 29, 2009, 11:47:53 AM5/29/09
to CslaGenerator
Hello everyone!

I'm very sorry it's taken this long to get back on track. I've been making massive changes throughout the code base since last release. Unfortunately, due to some various health issues (first it was my eye, then I fractured my elbow and recently I've been fighting a problem in the upper section of my spine) and some vacation time things slowed down since january. I was planning a release for february but worked piled up and I had to catch up. Anyway, I'm trying to get caught up with things and I thought it was time to release this now aging features that few have seen.

Let me start by saying that CSLA35 (>=3.5) is now in. VB only for now. Volunteers for the C# port are more than welcome.
CSLA35 now brings a new setting in the project properties panel where you can define which kind of property declaration you want to use. Also, the event model has been changed, we now use partial methods instead of events. Partial methods take a special argument: a DataPortalHookArgs class that you'll add to your projects. Look for it in the Resources folder.

OK, the following is a list of stuff I've been working on for a while. These changes also apply to CSLA20 users, so read on!

Database loading:
-Now loading tables and views in a batch, reducing load time to less than 10% than what it used to be.
-New Reload context menu item, allowing you to refresh one table/view/sproc at a time instead of the whole schema.
-Sprocs are listed, but not loaded. You can use the context menu to load them when you need them. If any business objects reference a sproc, then that sproc is loaded automatically.
-Each of these steps now shows load times, so you can easily identify which sprocs take too long to load.

To be perfectly clear: tested on a _huge_ database (1GB of data, 1081 tables, 306 views and 1837 sprocs) that used to take well over 15 minutes to load, it now takes less than 5 seconds. Again, this is listing sprocs without loading any resultsets.
I also ran tests with loading all sprocs and that same DB ran in less than 4 minutes,.
I'd like to extend a huge thank you to Kevin Welsh for trusting me with such massive database.

The downside to the new sproc lazy loading approach is that it shows you _every_ sproc, instead of just the ones that return actual resultsets as before.

Rules:
-ArgumentType: You can choose between RuleArgs and DecoratedRuleArgs. (Csla 3.0 and beyond).
-DecoratorArgs: This is a collection where you can define the decorator arguments. It has 3 properties: Name, Value and ValueType.
-DescriptionType: String/Code. The difference here is that if you choose code, it doesn't output quotes for the description, allowing you to get the string from a function, resource or whatever.
-Mode: Generated/Custom/CustomGeneric. Generated is the standard way and it's what we've always had so far. Custom only does the AddRule() call without generating an actual rule method so that you can code it by hand or call an external validation routine. CustomeGeneric is the same as custom, the difference is that Custom uses "object" as the target type and custom generic uses the business object's type as the target type.
-Description can now use a format string, where {0} will be passed the friendly name of the property. i.e.: "{0} is a required field"
-Assert expression now also uses format strings, so you can use {0} to output the field name. i.e.: "{0}.Length > 0"
-Also, for both assert expression and description, if you have decorator args, you'll get them as {1}...{n}.

Plugins:
-New interface for creating simple plugins: ISimplePlugin.
-You can inherit SimplePluginBase (that implements ISimplePlugin) to simplify the creation of the plugin if you want.
-The interface let's you specify actions that will be added to a Plugins menu.
-You'll get database information and your object model (which contains the project settings and the list of objects) so you can make changes to it.
-While it won't let you interact with the ui to add custom controls everywhere (that's why it's called simple plugin), you can create forms that are shown when your plugin gets called.
-Possible usage scenarios: Scripting common tasks, Adding your custom rules to objects, Creating objects for all your tables automatically with one click, etc.


Smarter project output paths: You can now use relative paths for the project output folder. For instance, ".\" will output all the code to the folder where the xml is currently in, or "..\MyLib" for... well, you know :). This may not seem very interesting to some people, but if you work with teams of people and source control, they currently need to deal with the output path changing every time they update their xmls or force everybody to have the projects in the same path to avoid issues. I plan on doing more changes to help deal with source control issues and improve things for everybody.

Fixes:
-SqlParameters are now passed the DbType. This is crucial for nullable fields.



Have fun with it!

Binaries:
http://www.softwarethinking.com/CslaGen/CslaGenerator-20090529.rar

SVN Tag for this release:
https://cslagen.svn.sourceforge.net/svnroot/cslagen/tags/20090529

--
Andrés

Q Johnson

unread,
May 29, 2009, 12:54:20 PM5/29/09
to CslaGe...@googlegroups.com
Thanks so much for your work on this.  I've been fighting health issues myself for over a month with about two more months to go.  I've been using some of the "down time" during treatments to finally get up to speed to VS2008 and .NET 3.5.  This is perfect timing for me.  I'm be making the jump all the way from code generation of CSLA 1.5.3 object using my own templates with MyGeneration, to CSLA 3.5 with CSLAGen.
 
What would I have to be doing without your tool?  I shudder to think.  Good luck returning to full strength SOON!
 
Q
 

Robert "Q" Johnson
Managing Member, TeamNFP
Software Solutions for the Sage MIP Community
512 255-7566 Voice
512 255-3164 FAX

 


From: CslaGe...@googlegroups.com [mailto:CslaGe...@googlegroups.com] On Behalf Of Andrés Villanueva
Sent: Friday, May 29, 2009 10:48 AM
To: CslaGenerator
Subject: New version, CSLA35 - huge improvement loading DBs - Plugins - Better rules

Codesol BeyondNet

unread,
May 29, 2009, 12:57:39 PM5/29/09
to CslaGe...@googlegroups.com, evel...@ransa.net, jorge...@hotmail.com
Thank you very much!

We will be communicating to the Hispanic community CSLA. NET
 
 
 
----- Original Message -----
Sent: Friday, May 29, 2009 10:47 AM
Subject: New version, CSLA35 - huge improvement loading DBs - Plugins - Better rules

William McNeill

unread,
May 29, 2009, 4:47:58 PM5/29/09
to CslaGe...@googlegroups.com

Your efforts are greatly appreciated!

 

-- Bill

 


From: CslaGe...@googlegroups.com [mailto:CslaGe...@googlegroups.com] On Behalf Of Andrés Villanueva
Sent: Friday, May 29, 2009 10:48 AM
To: CslaGenerator
Subject: New version, CSLA35 - huge improvement loading DBs - Plugins - Better rules

 

Hello everyone!

Alejandro Savelli

unread,
May 29, 2009, 4:50:38 PM5/29/09
to CslaGe...@googlegroups.com
Thank you very much !!!!

Great job, as usual...

And... HAPPY BIRTHDAY :)

Fahmi

unread,
May 30, 2009, 9:39:08 AM5/30/09
to CslaGenerator
Hello Andrés,

Tahnk you so much for the update..
Happy Birthday, and wish you all the best

Really appriciate your effort

Regards
Fahmi

pandelis

unread,
Jun 3, 2009, 11:30:13 AM6/3/09
to CslaGenerator
Amazing work!!!! I cant thank you enough!

Tiago

unread,
Jun 3, 2009, 6:36:30 PM6/3/09
to CslaGenerator
Hi Andrés,

Thanks for all the hard work in spite of all your personal problems.

> Volunteers for the C# port are more than welcome.

Anyone?

Jedi Master Spooky

unread,
Jun 3, 2009, 9:58:07 PM6/3/09
to CslaGenerator
If I can Help count me in. I live In Argentina and work every day with
Csla and C#

Tiago

unread,
Jun 6, 2009, 5:35:54 PM6/6/09
to CslaGenerator
Hi Jedi,

I guess anyone can count himself in. Please go ahead.
> > Anyone?- Ocultar texto citado -
>
> - Mostrar texto citado -

Ed

unread,
Jun 22, 2009, 12:21:18 PM6/22/09
to CslaGenerator
Hi Andres,

It would seem that I'm the only ignorant newbe but...

You wrote

"Partial methods take a special argument: a DataPortalHookArgs class
that
you'll add to your projects. Look for it in the Resources folder. "

I've generated a small sample project and in creating NVL I get
generated code for OnFetchPre and OnFetchPost

OnFetchPre(cmd, crit)
LoadCollection(cmd)
OnFetchPost(cmd, crit)

Generating errors on both the cmd and the crit

Error on the cmd "Value of type 'System.Data.SqlClient.SqlCommand'
cannot be converted to '<ProjectName>.DataportalHookArgs'"
Error on the crit "Too many arguments to 'Private Sub OnFetchPre(args
as DataPortalHookArgs)'.

Am I missing something in the set-up prior to generation?
How should these parameters be defined?
Is the a working example somewhere to look at?

Thanks a lot!

Ed
> > - Mostrar texto citado -- Hide quoted text -
>
> - Show quoted text -

Andrés Villanueva

unread,
Jun 22, 2009, 12:31:52 PM6/22/09
to CslaGe...@googlegroups.com
Hi Ed

Sorry, that was a template issue, I'm attaching a correct template. You should replace the current one in "Templates\CSLA35\VB" with this one.
--
Andrés
NameValueList.cst

Ed

unread,
Jun 26, 2009, 10:21:47 AM6/26/09
to CslaGenerator
Andrés,

Great Thanks... that works much better.

Another question... what version of CSLA do you work with? I'm
referencing 3.6.2 on a test project
and I'm have some issues the called DataPortal.Fetch with a NVL
object.

The error I'm getting is:

"Format of the initialization string does not conform to specification
starting at index 0."

I can reference a different CSLA version if that will help.

Thanks again... there is obviously a lot of lost sleep embedded in
this effort. Much appreciated.

Ed
>  NameValueList.cst
> 8KViewDownload- Hide quoted text -

Andrés Villanueva

unread,
Jun 26, 2009, 10:35:16 AM6/26/09
to CslaGe...@googlegroups.com
Hi Ed,
I've been using the latest versions all the time. That's a weird error.
Is that an exception? Do you have a stack trace? Did you try debugging it to see what line was causing it?
--
Andrés

Ed

unread,
Jun 26, 2009, 11:32:20 AM6/26/09
to CslaGenerator
Andrés,

OK... so the version is not the problem. I must be something that I'm
doing wrong.

It fails when it attempts to execute:

public static T Fetch<T>(object criteria)
{
return (T)Fetch(typeof(T), criteria);
<----------- trips error
}

Debug Win Output:

'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped
loading symbols. Module is optimized and the debugger option 'Just My
Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities
\9.0.0.0__b03f5f7f11d50a3a
\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading
symbols. Module is optimized and the debugger option 'Just My Code' is
enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Windows.Forms
\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading
symbols. Module is optimized and the debugger option 'Just My Code' is
enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped
loading symbols. Module is optimized and the debugger option 'Just My
Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a
\System.Drawing.dll', Skipped loading symbols. Module is optimized and
the debugger option 'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync
\9.0.0.0__b03f5f7f11d50a3a
\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped
loading symbols. Module is optimized and the debugger option 'Just My
Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime
\9.0.0.0__b03f5f7f11d50a3a
\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading
symbols. Module is optimized and the debugger option 'Just My Code' is
enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'E:\Dev\ProdAdminCSLA
\CSTest1\ProdAdminCS\ProdAdminCS.Win\bin\Debug
\ProdAdminCS.Win.vshost.exe', Skipped loading symbols. Module is
optimized and the debugger option 'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Xml.Linq
\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll', Skipped loading
symbols. Module is optimized and the debugger option 'Just My Code' is
enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Data.DataSetExtensions
\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll', Skipped
loading symbols. Module is optimized and the debugger option 'Just My
Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Deployment\2.0.0.0__b03f5f7f11d50a3a
\System.Deployment.dll', Skipped loading symbols. Module is optimized
and the debugger option 'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
The thread 0x143c has exited with code 0 (0x0).
The thread 0x284 has exited with code 0 (0x0).
The thread '<No Name>' (0x1160) has exited with code 0 (0x0).
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'E:\Dev\ProdAdminCSLA
\CSTest1\ProdAdminCS\ProdAdminCS.Win\bin\Debug\ProdAdminCS.Win.exe',
Symbols loaded.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'E:\Dev\ProdAdminCSLA
\CSTest1\ProdAdminCS\ProdAdminCS.Win\bin\Debug\ProdAdminVB.Lib.dll',
Symbols loaded.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'E:\Dev\ProdAdminCSLA
\CSTest1\ProdAdminCS\ProdAdminCS.Win\bin\Debug\Csla.dll', Symbols
loaded.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a
\System.Configuration.dll', Skipped loading symbols. Module is
optimized and the debugger option 'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Skipped
loading symbols. Module is optimized and the debugger option 'Just My
Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\PresentationFramework
\3.0.0.0__31bf3856ad364e35\PresentationFramework.dll', Skipped loading
symbols. Module is optimized and the debugger option 'Just My Code' is
enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\WindowsBase\3.0.0.0__31bf3856ad364e35\WindowsBase.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_32\PresentationCore
\3.0.0.0__31bf3856ad364e35\PresentationCore.dll', Skipped loading
symbols. Module is optimized and the debugger option 'Just My Code' is
enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a
\System.EnterpriseServices.dll', Skipped loading symbols. Module is
optimized and the debugger option 'Just My Code' is enabled.
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'Anonymously Hosted
DynamicMethods Assembly'
A first chance exception of type 'System.ArgumentException' occurred
in System.Data.dll
The thread 0x1390 has exited with code 0 (0x0).
A first chance exception of type 'Csla.Reflection.CallMethodException'
occurred in Csla.dll
A first chance exception of type 'Csla.Server.DataPortalException'
occurred in Csla.dll
A first chance exception of type 'Csla.Server.DataPortalException'
occurred in Csla.dll
A first chance exception of type 'Csla.Server.DataPortalException'
occurred in Csla.dll
A first chance exception of type 'Csla.DataPortalException' occurred
in Csla.dll
A first chance exception of type 'Csla.DataPortalException' occurred
in Csla.dll
'ProdAdminCS.Win.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly
\GAC_MSIL\Microsoft.VisualStudio.DebuggerVisualizers
\9.0.0.0__b03f5f7f11d50a3a
\Microsoft.VisualStudio.DebuggerVisualizers.dll'


Any suggestions would be greatly appreciated.

Regards,

Ed
> Andrés- Hide quoted text -

Andrés Villanueva

unread,
Jun 26, 2009, 11:56:46 AM6/26/09
to CslaGe...@googlegroups.com
Are you using remoting, wcf, or any other kind of remote portal?
Looks like that's obscuring the actual exception... Try disabling the remote portal connecting straight to the database. Then you'll be able to go through the rest of the code in your class (like the actual DataPortal_Fetch() method).
Alternatively, you could try hooking up the debugger to the remote process to debug it.
--
Andrés
Reply all
Reply to author
Forward
0 new messages