Q for the template gurus (of the VS.NET flavor)

Posts   
 
    
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 10-Jul-2005 20:34:41   

I'm trying to create a custom VS.NET project and I'm having a problem in one of the templates. I know these templates aren't the same as LLBLGen's, but this seems like a good place to ask for help. simple_smile

In my .cs files for my VS.NET (2003) project template, I want to do something like this:


[!if DAL_REFERENCED]
using SD.LLBLGen.Pro.ORMSupportClasses;
using [!output MY_PROJECT_NAME].DAL;
using [!output MY_PROJECT_NAME].DAL.DatabaseSpecific;
using [!output MY_PROJECT_NAME].DAL.EntityClasses;
using [!output MY_PROJECT_NAME].DAL.FactoryClasses;
using [!output MY_PROJECT_NAME].DAL.HelperClasses;
[!endif]

The part that doesn't work is the conditional statement. The code is always included, regardless of whether or not DAL_REFERENCED is true or false. In the default.js file for this template, I have the following code:


// add a reference to DotNetNuke project
x = prjs.Count;
VSProject = proj.Object;
refs = VSProject.References;
var bDalReferenced = false;
for (var i=1 ; i<=x ; i++ )
{
    tempproject =   prjs.item(i);

    if(tempproject.name == strMyProjectName + ".DALDBSpecific" ||
        tempproject.name == strMyProjectName + ".DAL") 
    {
        ref = refs.AddProject(tempproject);
        ref.CopyLocal = false;
        bDalReferenced = true;
    }
    
}

wizard.AddSymbol("DAL_REFERENCED", bDalReferenced);

That should allow the conditional in the first code block to work correctly. I'll share the project templates if we can get this working!

By the way, if you haven't figured it out, the idea here is that by adding a new project to a solution which contains projects named <projectname.DAL and <projectname>DALDBSpecific, references are automatically added to those projects. Also, for every new UserControl or WebForm you create, the appripriate usings are added. I go through this process a lot when creating DotNetNuke modules. "DNN Jungle" has a set of project templates for VS.NET, but they're too closely tied to DNN's default data provider and thus useless for us LLBLGeners...

Thanks!

cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 11-Jul-2005 06:54:22   

May I suggest looking into LPT templates?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39801
Joined: 17-Aug-2003
# Posted on: 11-Jul-2005 10:30:51   

I don't recognize the syntax, is that VS.NET template language?

Frans Bouma | Lead developer LLBLGen Pro
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 11-Jul-2005 13:07:04   

Otis wrote:

I don't recognize the syntax, is that VS.NET template language?

Yes, that's the problem. They're VS.NET templates, and I couldn't find any information on applying conditional code sections in the template.

I was hoping that someone here was used to working with those, especially since the output of those templates is directly related to LLBLGen.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39801
Joined: 17-Aug-2003
# Posted on: 11-Jul-2005 13:29:40   

Isn't there some help in the VSIP sdk? (Which is free) ? (I don't know if there is any help on this, I never worked with that template language)

Frans Bouma | Lead developer LLBLGen Pro