dwighttovey wrote
A couple of questions on module packaging:
1 - Is it possible to create a module with no user interface? Basically we have a project that consists of multiple sub-modules that could be installed independantly of each other. Since they use the same core database structure, we would like to have one module that consists of nothing but the SQL tables and stored procedures. The idea is that this module would be installed first to create the necessary database structure, then the other modules could be installed without needing to create the structure. I've looked through the 'Module Developers Guide', but unless I'm missing something (highly probable), it looks like the .dnn file requires user controls. I want a module that only has the SqlDataProvider install/uninstall scripts. Possible?
2 - Along with that, does the DNN module installation process support the idea of dependancies? If that core module hasn't been installed yet, I would like the other module installations to fail (preferably with a message explaining what dependancies are missing).
Thanks for any suggestions.
I'de recommend including the SQL with every module and not worrying about it. Key thing here is not use the "standard" DROP TABLE statements, but rather something like I use in my modules (helps a bit to avoid those "mishaps"):
IF NOT EXISTS (SELECT * FROM {databaseOwner}SYSOBJECTS WHERE id = object_id(N'{databaseOwner}[{objectQualifier}MedRecBlogsRead]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
CREATE TABLE {databaseOwner}[{objectQualifier}MedRecBlogsRead] (
[ID] int IDENTITY ( 1,1 ) NOT NULL,
[UserID] int NULL,
[SourceBlogUserID] int NULL,
[LastVisited] datetime NULL
)
ALTER TABLE {databaseOwner}[{objectQualifier}MedRecBlogsRead] WITH NOCHECK ADD
CONSTRAINT [{objectQualifier}PK_MedRecBlogsRead] PRIMARY KEY CLUSTERED
(
[ID]
) ON [PRIMARY]
ALTER TABLE {databaseOwner}[{objectQualifier}MedRecBlogsRead] ADD
CONSTRAINT [{objectQualifier}FK_MedRecBlogsRead_{objectQualifier}Users] FOREIGN KEY
(
[SourceBlogUserID]
) REFERENCES {databaseOwner}[{objectQualifier}Users](
[UserID]
) ON DELETE CASCADE
END
GO
Second, on the dependancy issue: I'm not aware of anything in the core to allow this. If the installer finds all the files, and there are no SQL errors: you get the module available to be installed on pages. No custom code in your module is run (although this would be a very useful feature for module developors).
If it was me, and if it's a product as it sounds like it is, perhaps consider making a small control-panel "installer" module designed specifically to install different components of your system. My wording probably makes it sound more complex then it really is.