p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 4th, 2009, 01:03 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Apr 2008
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default New Site Generator (T4 Templates)

Hi, i've just converted the templates from the flixon site generator to t4. This makes building your bll/dal even easier. This exercise was really just a learning curve for me in preperation for .net v4 and the entity framework but i thought i'd share my work.

Please note that t4 is a tool built into visual studio and therefore you must have visual studio to do this.

Here's how to get it working:

1. Download and install the t4 toolbox extension from http://www.codeplex.com/t4toolbox
2. Download the templates from http://www.flixon.com/MyFiles/Files/...eGenerator.rar
3. Extract the contents of the rar file to a seperate folder and copy into your web project.
4. Open the "Generator.tt" file and modify the settings at the top.
5. Modify the list of providers (line 40 to 44), eg the following will create 2 providers called Content (Categories and Documents table applied) and Users (Users table applied)

var providers = new List<Provider>()
{
new Provider { Name = "Content", Tables = database.Tables.Cast<Table>().ToList().FindAll(t => t.Name == "Categories" || t.Name == "Documents") },
new Provider { Name = "Users", Tables = database.Tables.Cast<Table>().ToList().FindAll(t => t.Name == "Users") }
};

6. Save the file. This will fire off the generator and may take a few minutes.

I've tried to set it out as clear as possible and once you start looking at the code you will see how simple it is to modify the templates to your liking. When you modify a template you need to either save the "Generator.tt" file or right click and click "Run Custom Tool" to trigger the code generator.

Hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old October 2nd, 2009, 10:01 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Which version

jgd12345 - what version did you use for the T4 implementation? I saw where
jimi was up to V3.? .. when I tried to get to his site I couldn't get there. I flixon site I only see V1.

I'm trying to track down the latest version and I'm hoping it was done using T4 by someone. thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old October 21st, 2009, 10:17 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi - i'm trying to set these templates up and keep getting errors such as:

================================================== =====
Error 5 Compiling transformation: 'Microsoft.VisualStudio.TextTemplating59CE26A6593B 8A252A7C0514F7FB919C.GeneratedTextTransformation.B izObjectTemplate' does not implement inherited abstract member 'Microsoft.VisualStudio.TextTemplating.TextTransfo rmation.TransformText()' e:\DotNetProjects35\MvcTest\MvcTest\FlixonT4SiteGe nerator\Generator\Templates\BizObject.t4 3 14
================================================== =====

is there any obvious thing i'm doing wrong/not doing?
many thanks...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old October 21st, 2009, 11:55 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

it's to do with the toolbox version i think.

replacing

protected override void RenderCore()

with

public override string TransformText()

moves things along to a new set of errors! oh well, progress of a kind!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old October 21st, 2009, 12:07 PM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and then this:

return this.GenerationEnvironment.ToString();


as the return value of each template fixes it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old October 30th, 2009, 11:42 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Apr 2008
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, yeah it looks like the issues you are having is because of the version of the t4 toolbox you are using. I can't remember exactly which version i'm using but try the latest anywayz.

As for the templates, i upgraded from my own set of templates but it should be relatively similar to v3. I believe the key differences are that my set of templates handles identity columns better but jimi's deals with many to many relationships better.

Sorry i can't be abit clearer. Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Generator GenXisT BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 9 November 3rd, 2009 11:52 AM
Announce: Site Generator V2 now available jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 56 October 2nd, 2009 02:06 PM
Flixon Site Generator jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 14th, 2008 11:33 AM
Date Sequence Generator Peso SQL Server 2000 8 May 18th, 2006 03:01 PM
random generator starsailor Javascript 1 December 7th, 2004 12:16 AM



All times are GMT -4. The time now is 04:00 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc