CodeSmith Template Questions

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/27/2009 5:49:18 PM
Gravatar
Total Posts 26

CodeSmith Template Questions

I have a few questions about the included CodeSmith Templates. :)


1) What is its purpose of the following line of code in "mp_UI-starter-ModuleControlGenerator.cst"?

// FeatureGuid <%= Guid.NewGuid().ToString() %>

 

 

2) Is it important to not use AutoEventWireUp? Or is just peronsal preference?
See "mp_UI-starter-ModuleControlGenerator.cst":

<%%@ Control Language="C#" AutoEventWireup="false" CodeBehind="<%= ControlName%>.cs" Inherits="<%=

UI_NameSpace%>.<%= FeatureName%>" %%>

 

 

3) Can you explain what the following piece of code does? If it weren't included, what could happen?
See "mp_UI-starter-ModuleControlGenerator.cst:

private void PopulateControls()
{
    TitleControl.Visible = !this.RenderInWebPartMode;

    if (this.ModuleConfiguration != null)
    {
        this.Title = this.ModuleConfiguration.ModuleTitle;
        this.Description = this.ModuleConfiguration.FeatureName;
    }

}

 


5/27/2009 6:03:48 PM
Gravatar
Total Posts 18439

Re: CodeSmith Template Questions

Hi Michael,

1. Every feature needs a feature guid, it should not be random across installations, it should be the same across installations this is just an easy way to generate one but it is arbitrary.

2. Personal preference. 

3. If a feature instance is enabled for MyPage as a webpart in module settings then when it renders in MyPage, the WebParts all get a title bar so the title control is redundant. When runing in MyPage the RenderInWebPartMode setting is true so it hides the module title control. The ModuleTitle control is strictly a convenience to make it easy to add a consistent title to different features, and to have a way to hook in edit links for a feature but you are completely free to leave it out and do your own thing. The if statement is just a defensive check to prevent errors in normal conditions its probably not needed.

Hope it helps,

Joe

5/27/2009 6:33:50 PM
Gravatar
Total Posts 26

Re: CodeSmith Template Questions

Hey Joe,

Thanks for your answers to question 2 and 3!

 - - - - - - - - - - - - - - -

You said...

1. Every feature needs a feature guid, it should not be random across installations, it should be the same across installations this is just an easy way to generate one but it is arbitrary.

 

Yes, I understand that each SiteModuleControl will have it's own GUID.  And that this GUID should be unique across installations.

 

FOLLOW UP QUESTIONS: How is this commented out line of code useful?

// FeatureGuid <%= Guid.NewGuid().ToString() %>

Rendered that line might end up like:

// FeatureGuid 994dfcb8-5ca5-4742-99a0-bc3b339f72cf

How is the database ever given this value?  How does the database use this?

 

thanks,
Michael

5/27/2009 6:48:35 PM
Gravatar
Total Posts 18439

Re: CodeSmith Template Questions

Hi Michael,

You have learned so far about how to "install" a feature via the UI, but there is an installation system to automate this that is used by all the features included with mojoPortal and you can leverage this installation sytem yourself in your own features.

http://www.mojoportal.com/using-the-installation-system.aspx

The feature guid should not be unique across installations, it should be consistent across installations but unique across features. Guid.NewGuid() always generates a new unique guid so its a convenient way to genertae a guid for you, you can copy it from the comments and use it to create your own feature definition file. This is what Tim was talking about in the other thread

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.