Sitefinity and Custom Modules - Part 2

by Jesse 13. May 2008 16:56

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: ,

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

Like the description says, at my core, I'm a scientist and engineer.  I came from humble beginnings on a 486DX2 Packard Hell playing doom2 on IPX to in a small time retail shop and got into hardware (ISO layers FTW!) and it was all downhill from there.  I'm infinitely curious about almost everything and always wanting to know.

Some of the stuff I'm currently into/researching...

Sitefinity

Ninject

Subsonic

Java

Currently working on ...
i did the hundred 
and some extra stuff

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's, their brother nor their dog's view in anyway.  At all.  Ever.

© Copyright 2007-2008