The big nerd. Like you have no idea.
engineering, coding, government, design, construction, development and some RTV gaskets (google it)

Sitefinity and Custom Modules - Part 2

May 13, 2008 22:56 by Jesse

After a solid day of working with my happy little module "SalesStats" I've come to some conclusions.

1. Subsonic CAN be used.

2. After the pain of the learning curve, sitefinity's setup ain't all bad!

3. I have yet to get my module working ...but I think I know why

First off, I had to figure out how to make subsonic work within an application and not a website.  No big deal, easy to do.  I had to do some quick research on how to generate ONE table out of the database (subsonic supports this!) and ok, great, I've got my data object, good, great, dandy -- for ref reasons, it looks something like this for your subsonic service...

<SubSonicService defaultProvider="MyProvider">
<
providers>
<
clear/>
<
add name="MyProvider" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="MyConnection"
fixPluralClassNames="false" spClassName="sp" generatedNamespace="MyClass.Data" includeTableList="MyNewUsefulTable"/>
</
providers>
</
SubSonicService>

"includeTableList" is a comma seperated list, so pound out what you need there.  For sitefinity, all you need is two ID fields, a guid as "ID" and an application nvarchar(50), ok fine, got that added in, ran the subsonic generator, done and done.

For a custom module, I've noted a couple objects you need to be aware of (at least as I understand it)

Configuration/ConfigurationHelper.cs - just a helper class, pulls the config section out for your newly added control.  Pay attention to this for the "GetSection(<place>)" and make sure it matches up.

Configuration/SectionHandler.cs - this pulls in your roles/users and other providers (if they exist).

Resources/Messages.resx - for localization.

Also in the resources folder I put in my subsonic DAL folder.

WebControls/Admin/CommandPanel.cs - inherits "CompositeControl" and "IControlPanelCommand".  This class is rather lightweight, contains a panelId, a simple override for CreateChildControls (take note of this, it'll come back a BUNCH of times) and a private value of panelId.  Easy stuff.  This is for your :gasp!: command panel, its the white er, gray space on the left in your admin module section.

WebConrols/Admin/ControlPanel.cs - inherits "CompositeControl".  Very involved and there's a few note worthy spots.  Enums -  Displaymode, 3 values, "new", "edit", "<object>List" or not new/edit.  Methods - override CreateChildControls(), probably the most important part in this control.  This is the controls you get on the screen.  That includes event handlers for buttons you add, dont forget those (you'll need 'em).  DefaultTemplate - InstantiateIn(Control container), main action happens here such as adding a datagrid, add/delete buttons, etc - you like this one.

In part 3 I'll finish this post with the rest of the explination (as I understand it) of the rest of the classes.


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: ,
Categories:
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

July 6. 2008 00:12