Wrox Programmer Forums
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2009, 12:03 PM
Registered User
 
Join Date: Apr 2008
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.
 
Old October 2nd, 2009, 09:01 AM
Registered User
 
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.
 
Old October 21st, 2009, 09:17 AM
Registered User
 
Join Date: Oct 2009
Posts: 4
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...
 
Old October 21st, 2009, 10:55 AM
Registered User
 
Join Date: Oct 2009
Posts: 4
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!
 
Old October 21st, 2009, 11:07 AM
Registered User
 
Join Date: Oct 2009
Posts: 4
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.
 
Old October 30th, 2009, 10:42 AM
Registered User
 
Join Date: Apr 2008
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





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 01: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 02:01 PM
random generator starsailor Javascript 1 December 7th, 2004 12:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.