Code Smith Templates to create web application

Posts   
1  /  2  /  3
 
    
bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 10-Aug-2004 22:54:45   

Devildog74 wrote:

bert, there's mail on the way to you.

Got your updates and thanks. The missing calls to GetCamelCase was an oversight I appreciate you cleaning it up. I do have a couple of questions

  1. You changed the controller class to be sealed classes. IS their a benefit to this?

  2. You changed the Null helper class to NullDefaults. I originally used Null as this is what is used by DotNetNuke, I did notice in C# that the intellisense did not like it when I called the class Null. Was this the reason that you changed it?

One thing I am working for the controller classes is logging ability For example any insert updates and deletes will be logged to a set of tables. I had a few ides of how I want to do this and was interested and what you thought

  1. Have the controller classes inherit from the DataAccessAdapter. I would override OnSaveEntity, OnDeleteEntity and OnUpdateEntity I would perform my logging logic here
  2. Create a logging adapter object that inherits form DataAccessAdapter. Cal this adapter object from my controller classes

Bert

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 10-Aug-2004 23:28:40   

bertcord wrote:

  1. You changed the controller class to be sealed classes. IS their a benefit to this?

hum I will answer my own question. I decided to download FX cop and check it out

FxCop assumes that a type containing only static members is not designed to be inherited, because the type does not provide any functionality that can be overridden in a derived type. A type that is not meant to be inherited should be marked with the sealed modifier to prohibit its use as a base type.

bert

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 11-Aug-2004 10:50:37   

bertcord wrote:

bertcord wrote:

  1. You changed the controller class to be sealed classes. IS their a benefit to this?

hum I will answer my own question. I decided to download FX cop and check it out

FxCop assumes that a type containing only static members is not designed to be inherited, because the type does not provide any functionality that can be overridden in a derived type. A type that is not meant to be inherited should be marked with the sealed modifier to prohibit its use as a base type.

bert

There is no real "benefit" perse, just that when a developer looks at the class, they will know immediately that there is nothing in the class that is instance specific and that it is meant to be strictly a services based object.

One cumbersome thing about FxCop is that there is no way to bulk exclude errors, so if there were a lot of controllers, there would be alot to exclude.

I changed the Null classes name from Null to NullDefaults, because Null is a reserved word.

In regards to logging, I would probably create an derived DataAccessAdapter (option 2), with overloads for SaveEntity, DeleteEntity, etc. that had the logging built into it. I am not sure how you could implement logging for recursive actions though.

Posts: 497
Joined: 08-Apr-2004
# Posted on: 11-Aug-2004 14:19:26   

Bert,

Just wanted to say Fantastic job simple_smile I had a few mins spare to try this yesterday, and after ecompiling your code with my version of codesmith, I was getting an index out of bounds error - its prob. my fault or something in my setup so I'll try it again soon (with Devildogs templates), but just wanted to say thanks for sharing this!

Posts: 497
Joined: 08-Apr-2004
# Posted on: 11-Aug-2004 23:25:02   

Hi,

OK, I added a single table to a test LLBL project (10-July-2004 version), and built. When I run master.cst, it chugs for a while, but then I get the following error.

System.NullReferenceException: Object reference not set to an instance of an object.
   at _CodeSmithTemplate.ASCXASPX_cst.__RenderMethod1(TextWriter writer, Control control)
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToFile(String path, Boolean overwrite)
   at BC.LLBLGen.Pro.CSTemplates.LLBLBaseCodeTemplate.RenderToFileForEachSingleKeyEntity(String TemplatePath, String OutputDirectory, CodeGenObject objecttype, String FileExtension, Hashtable TemplateParameters)
   at _CodeSmithTemplate.MasterWebApplication_cst.Go() in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\telgtcwd.0.vb:line 92
   at _CodeSmithTemplate.MasterWebApplication_cst.__RenderMethod1(TextWriter writer, Control control) in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\telgtcwd.0.vb:line 256
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToFile(String path, Boolean overwrite)
   at _CodeSmithTemplate.Master_cst.Go() in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\ql9fyuyq.0.vb:line 138
   at _CodeSmithTemplate.Master_cst.__RenderMethod1(TextWriter writer, Control control) in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\ql9fyuyq.0.vb:line 247
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToString()
   at CodeSmith.Gui.CodeTemplateGenerator.a(Object , EventArgs )

Maybe i need to make some changes to the cst file as "free4all" suggested. I'll play some more, I just posted this in case you knew off the top of your head why this occurs?

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 12-Aug-2004 14:14:33   

Does your test table have a primary key?

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 12-Aug-2004 16:09:22   

MattWoberts wrote:

Hi,

OK, I added a single table to a test LLBL project (10-July-2004 version), and built. When I run master.cst, it chugs for a while, but then I get the following error.

yeah debugging in codesmith kinda of sucks but I do have some experience so I Can help.

ok looking at the error it appears the error was thrown in the ASCXASPX. Expand the WebApplication Folder and open the ASCXASPX.cst template.

Open your LLBLGenPRoject file from this template. The master tempalte executes this template for each entity in your project. You can figure out which entity it is bombing on by changing the EntityIndex Property.

Make sure your LLBLGen project has all entities that make up a FK relation. For example if you had a project using the Northwind.... IF you add the Orders table you must also add the Employees, Shippers and Customers Entites.

This is required as these objects need to be used to populate the orders entity.

Let me know if this helps.

Bert

Posts: 497
Joined: 08-Apr-2004
# Posted on: 13-Aug-2004 23:27:12   

Hi again!

Thanks a lot for the help Bert/Devildog. I know absolutely nothing about codesmith so its all a bit of a mystery to me!

Anyway, sure enough, i only added the one entity, not the FK entities that were needed for it. So, I went back into the LLBL project and added the other entities that were required. I tried to compile again and this time I got a new error (progress I think)

System.ArgumentOutOfRangeException: Index was out of range.  Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.ArrayList.get_Item(Int32 index)
   at _CodeSmithTemplate.Controller_cst.__RenderMethod1(TextWriter writer, Control control) in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\ikzoe6vj.0.vb:line 104
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToFile(String path, Boolean overwrite)
   at BC.LLBLGen.Pro.CSTemplates.LLBLBaseCodeTemplate.RenderToFileForEachEntity(String TemplatePath, String OutputDirectory, CodeGenObject objecttype, String FileExtension, Hashtable TemplateParameters)
   at _CodeSmithTemplate.MasterBL_cst.Go()
   at _CodeSmithTemplate.MasterBL_cst.__RenderMethod1(TextWriter writer, Control control)
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToFile(String path, Boolean overwrite)
   at _CodeSmithTemplate.Master_cst.Go() in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\cdgnmoab.0.vb:line 99
   at _CodeSmithTemplate.Master_cst.__RenderMethod1(TextWriter writer, Control control) in C:\DOCUME~1\MATTRO~1\LOCALS~1\Temp\cdgnmoab.0.vb:line 247
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToString()
   at CodeSmith.Gui.CodeTemplateGenerator.a(Object , EventArgs )

So, its complaining about an array index. I am guessing its teh BL code gen that is failing, but where should I be looking? What array is going wrong, is it an array of the data in the table perhaps?

Should I try a completely different database, is it likely to be the DB I am trying that is causing probs for me?

Thx!!

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 13-Aug-2004 23:41:04   

MattWoberts wrote:

So, its complaining about an array index. I am guessing its teh BL code gen that is failing, but where should I be looking? What array is going wrong, is it an array of the data in the table perhaps?

It looks like it is the controller classes. Try the following

  1. Make sure that you have saved the updated LLBLGen PRoject file. Make sure and reload teh updated LLBLGen PRoject file into codesmith.

IF you still have errors. Open the controller cst file and try running the template for each entity.

Bert

uydo
User
Posts: 43
Joined: 09-Dec-2003
# Posted on: 08-Sep-2004 17:00:44   

Any updates on this cool tool? I long to wait for something like this for a looong time alreadysimple_smile Thanks. Uy

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 10-Sep-2004 22:37:56   

uydo wrote:

Any updates on this cool tool? I long to wait for something like this for a looong time alreadysimple_smile Thanks. Uy

I have an update that I hope to post early next week. IT will include the following

*Added Validater controls based on datatype to the webforms *Moved all properties to LLBLBaseCodeTemplate. These properties are persisted to the *LLBLGen Project file. *Added option for projects to use DLL Reference rather than project ref *Added VB Scripts to add and remove server controls from toolbox

I still have soem Issues I need to work out prior to me calling it a release. sunglasses After that I will start working on server controsl for each entity and look at the beta runtime libs.

I am getting married next weekend so dont expect too much until mid October.

Bert

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 10-Sep-2004 22:55:53   

bertcord wrote:

I am getting married next weekend so dont expect too much until mid October.

Bert

All sort of life-changing things happening around here. Congratulations!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39741
Joined: 17-Aug-2003
# Posted on: 10-Sep-2004 23:29:43   

bertcord wrote:

I am getting married next weekend so dont expect too much until mid October.

Bert

Congratulations, Bert!! simple_smile

And don't forget to post a picture of the lovely couple in the it's friday thread sunglasses

Frans Bouma | Lead developer LLBLGen Pro
wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 11-Sep-2004 08:52:23   

I am getting married next weekend so dont expect too much until mid October.

Married life, i have been married for almost a year and so far i found it to be pretty cool sunglasses Congrats, Remember the pics.simple_smile

Just remember nothing is sopose to change once you get married, each one should just continue to be himself - Friends for live.

lyndon_h
User
Posts: 79
Joined: 14-Sep-2004
# Posted on: 14-Sep-2004 22:59:52   

this is a very cool tool. It will really help in testing applications.

Bert, you need to get your priorities together and get this tool out. the future wife can wait!!!!

stuck_out_tongue_winking_eye

lyndon_h
User
Posts: 79
Joined: 14-Sep-2004
# Posted on: 18-Sep-2004 00:04:34   

Bert,

I'm not sure if you just haven't developed it yet or maybe it hasn't been developed, but i'm unable to create DotNetNuke modules because MasterDNNModule.cst is not included in the zip file.

Thanks again, Lyndon smile

jsaylor
User
Posts: 37
Joined: 20-Sep-2004
# Posted on: 22-Sep-2004 20:02:56   

Everyone,

I've just been intrigued by the poject enough to dl and plunk around with it - very cool.

Any idea when everyone's latest and greatest additions/versions are going to be available? And, additionally, at what venue (updated here or elsewhere?)?

In order to relieve Fran's forum a bit, if you'anyone is interested I could host a Sharepoint team site on my companies' server and a Subversion source code repository for the project - that would allow everyone to be able to collaborate a little more effectively than posts here(and obviously there are other avenues as well: gotDotNet workspace, sourceforge, etc.) . If interested, let me know.

Cheers,

Jeffrey J. Saylor Deadworks, Owner http://www.deadworks.com

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39741
Joined: 17-Aug-2003
# Posted on: 22-Sep-2004 20:44:20   

A subversion server with the shared code would be great!

Forget gotdotnet or sourecforge, the first is crap and hte latter will probably not accept the project.

If you need help, let me know simple_smile

Thanks for the offer! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39741
Joined: 17-Aug-2003
# Posted on: 23-Sep-2004 11:53:37   

Btw, I can also setup a subversion repository on our online box (till april next year). Because almost all ports are blocked I have to make special arrangements for allowing external svn clients access the repository. I'll check it out this weekend.

Frans Bouma | Lead developer LLBLGen Pro
jsaylor
User
Posts: 37
Joined: 20-Sep-2004
# Posted on: 24-Sep-2004 18:44:15   

No prob - I'll set up a sharepoint site plus a subversion repository this weekend, I'll have it available on Monday.

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 24-Sep-2004 19:45:53   

lyndon_h wrote:

I'm not sure if you just haven't developed it yet or maybe it hasn't been developed, but i'm unable to create DotNetNuke modules because MasterDNNModule.cst is not included in the zip file

I have completed thsi but have not had the time to uplaod just yet....

jsaylor wrote:

In order to relieve Fran's forum a bit, if you'anyone is interested I could host a Sharepoint team site on my companies' server and a Subversion source code repository for the project - that would allow everyone to be able to collaborate a little more effectively than posts here(and obviously there are other avenues as well: gotDotNet workspace, sourceforge, etc.) . If interested, let me know.

Thanks for the offer. I woudl actually like to set up a forum on my own site using the asp.net forum 2 code. As far as subversion I might be interested in that ...but I have never used it. (I use vault now)

I have multiple updates I did not have a chance to post, and an outline of new things to get done. I will post these when I get back from Hawaii the first week of OCt.

Thanks Bert

lyndon_h
User
Posts: 79
Joined: 14-Sep-2004
# Posted on: 26-Sep-2004 21:55:33   

Thanks Bert. Have a good time in Hawaii. This is the perfect time of year to be having a weddding. My wife and I are celebrating our first honeymoon tomorrow. Thats why im getting in all of my computer fun today. Cause she wont be happy if i'm on the computer tomorrow smile

bertcord wrote:

lyndon_h wrote:

I'm not sure if you just haven't developed it yet or maybe it hasn't been developed, but i'm unable to create DotNetNuke modules because MasterDNNModule.cst is not included in the zip file

I have completed thsi but have not had the time to uplaod just yet....

jsaylor wrote:

In order to relieve Fran's forum a bit, if you'anyone is interested I could host a Sharepoint team site on my companies' server and a Subversion source code repository for the project - that would allow everyone to be able to collaborate a little more effectively than posts here(and obviously there are other avenues as well: gotDotNet workspace, sourceforge, etc.) . If interested, let me know.

Thanks for the offer. I woudl actually like to set up a forum on my own site using the asp.net forum 2 code. As far as subversion I might be interested in that ...but I have never used it. (I use vault now)

I have multiple updates I did not have a chance to post, and an outline of new things to get done. I will post these when I get back from Hawaii the first week of OCt.

Thanks Bert

uydo
User
Posts: 43
Joined: 09-Dec-2003
# Posted on: 27-Sep-2004 16:50:10   

It seems like we are having a wedding race in this forum huh?simple_smile Anyway, I'd like to congrats & welcome all new couples with this poem:

I dreamed of a wedding of elaborate elegance, A church filled with family and friends. I asked him what kind of a wedding he wished for, He said one that would make me his wife.

~Author Unknown

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Nov-2004 19:48:10   

Bert,

Are you still going to update this to work with Frans' new stuff instead of CodeSmith?

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 28-Nov-2004 03:15:30   

JimFoye wrote:

Bert,

Are you still going to update this to work with Frans' new stuff instead of CodeSmith?

yes I am .. I have actually completley reqritten them. Instead of outputting a webpage for each entity I am creating a server control with full design time support.

You can programtically show and hide fields and set default values.

I am flying to Calgary tomorrow so hope to get a beta togeter soon. I am gogin to send Frans a sample and get some feedback and then I am going to figure out how to use the new template studio.

I promise a beta within the next 2 weeks.

Bert

1  /  2  /  3