Trying to generate View Folders for Entities for MVC3

Posts   
 
    
amitjindal
User
Posts: 34
Joined: 03-Jun-2010
# Posted on: 13-Apr-2013 13:46:24   

Hi,

We are new to Custom templates so please forgive if this is trivial. We are trying to generate customized MVC3 templates. For that we got almost all things working however we need to generate folders for Entities so that views can be inside them. To explain:

Lets say I have tables: Order, Employee and Department. In my Views folder, I should have folders by the name Order, Employee and Department so that respective Views for the controller should go there. We are able to generate the views in Views folder. We got a hack working where via C# code we are able to generate folders for each entity with LPT file is called.

However we are not able to figure out how to put the views in subfolders. We tried providing "[entityName]" format in destination folder where output of the LPT is generated but it is not taking a pattern and it creates a folder by the name "[entityName]".

Perhaps there is a much cleaner way to do this.

Please help.

Amit

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 14-Apr-2013 23:53:47   

Hi Amit,

For the FolderPerEntity question, it's no possible with the built-in task perfomers because the DirectoryCreator doesn't act on all entities. This is an alternative (creating a new task performer): http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17154

Now, to actually generate an entity on \baseFolder[elementName] I think that it's not possible, because [elementName] is not recognize as a placeHolder on the "destinationFolder" task's parameter. I will investigate this, but in the meantime you should write a DOS script to do that for you.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 15-Apr-2013 11:45:36   

What's your llblgen pro version? v4 generates folders on the fly for files, so no need to create folders first. v4 and v3.5 also replace [elementName] with the name of the element. so be sure to use [elementName] in your filename directive in the task.

Frans Bouma | Lead developer LLBLGen Pro
amitjindal
User
Posts: 34
Joined: 03-Jun-2010
# Posted on: 15-Apr-2013 14:08:41   

daelmo wrote:

Hi Amit,

For the FolderPerEntity question, it's no possible with the built-in task perfomers because the DirectoryCreator doesn't act on all entities. This is an alternative (creating a new task performer): http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17154

Now, to actually generate an entity on \baseFolder[elementName] I think that it's not possible, because [elementName] is not recognize as a placeHolder on the "destinationFolder" task's parameter. I will investigate this, but in the meantime you should write a DOS script to do that for you.

Thanks David. We got it working via a hack. We wrote a LPT which moves files. Right now we just needed proof of concept. Next we clean these to make them properly working.

amitjindal
User
Posts: 34
Joined: 03-Jun-2010
# Posted on: 15-Apr-2013 14:09:32   

Otis wrote:

What's your llblgen pro version? v4 generates folders on the fly for files, so no need to create folders first. v4 and v3.5 also replace [elementName] with the name of the element. so be sure to use [elementName] in your filename directive in the task.

Frans, I just upgraded to 4 last week. However didn't really get a chance to try that. Will try.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Apr-2013 09:48:31   

amitjindal wrote:

daelmo wrote:

Hi Amit,

For the FolderPerEntity question, it's no possible with the built-in task perfomers because the DirectoryCreator doesn't act on all entities. This is an alternative (creating a new task performer): http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17154

Now, to actually generate an entity on \baseFolder[elementName] I think that it's not possible, because [elementName] is not recognize as a placeHolder on the "destinationFolder" task's parameter. I will investigate this, but in the meantime you should write a DOS script to do that for you.

Thanks David. We got it working via a hack. We wrote a LPT which moves files. Right now we just needed proof of concept. Next we clean these to make them properly working.

Amit, I just double check Frans post. And yes, you can put [elementName][elementName]Entity.[extension] on the fileNameFormat parameter, not in the destinationFolder. So it works.

Also I confirm that with v4 is even easier: as Frans said, folders are created on the fly. So just put [elementName][elementName]Entity.[extension] on the fileNameFormat and the folders are created on the fly simple_smile

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 17-Apr-2013 10:19:43   

Indeed, I forgot to mention that 'destination folder' should be left empty in this case. It's a little confusing perhaps (which elements work in which parameters). We'll clear that up in a future version.

Frans Bouma | Lead developer LLBLGen Pro