Integration with non-MVC application questions

May 24, 2009 at 11:42 PM

Hello,

I would like to integrate the KiGG source into my existing Web Application Project that uses the ASP.NET Membership provider as a subfolder of the site so I can replace the existing login with my existing login and control panel. What you have looks great and from what I've seen so far, the MVC pattern seems like a superior way for web development, especially coming from a background in Windows development. I have already integrated a rather large forum codebase into my application so converting that along with my own code would probably take months. Has anyone been able to perform such an integration? MVC is so different from a traditional web application project, it's difficult to see how this is even possible. If someone could tell me where to begin and things to watch out for I would be glad to provide documentation for the process. I would just like a little help. Thank you!

May 27, 2009 at 10:13 PM

Well I gave integrating a shot to no avail. I tried integrating KiGG into a sub-folder of my project and the MVC integration examples I've seen involve integrating into the root directory of the project. I'll be giving that a shot next, but I would like to share the UNSUCCESSFUL steps that I've already taken to integrate since some issues came up that I would like to get some insight on. I've marked the steps where I had to take questionable actions to keep the project building and configuration from breaking my existing configuration with *s and explained below.

Integrate with non-MVC Web Application Project
----------------------------------------------
1. Backup  your exisiting code base and database.
2. Install .NET Framework v.3.5 SP1 and ASP.NET MVC 1.0.
3. Extract the Zip in a Directory (e.g. C:\Projects\KiGG).
4. Open your Web Application Project in Visual Studio 2008.
5. From Windows Explorer, drag the Web folder from the Kigg directory into your Web Application Project in Visual Studio.
6. Copy or move all dll files from Kigg's bin directory into the bin directory at the root of your Web Application Project. (I prefer to copy dll files to keep a record of Kigg specific references in the Kigg folder's bin directory)
7. Add a reference to all of the dlls copied in step 6 EXCEPT for Kigg.Web.dll and also to System.Web.Mvc.dll, System.Web.Routing.dll and System.Web.Abstractions.dll.
*8. Set the Build Action property of the Kigg folder's Properties\AssmblyInfo.cs file to None.
9. Set your Web Application's Target Framework to .NET v.3.5 from its Properties' Application tab.
10. At this point your Web Application Project should be able to successfully build so perform the build to double check.
11. In Kigg's Web.Config file, change the database Connection String to your own.
12. Now Create an Account in http://www.pageglimpse.com/ (Currently free service) and put it in web.config line 567.
13. Now Create an Account in http://recaptcha.net (free service) to get your API Keys. Once you got those put in your web.config line 1190 and 1193.
14. Integrating the Kigg's Web.Config file into your Web Applications Web.config file can be tricky and if your Web Application's Web.config is small, it may be easier to integrate your Web.Config into Kigg's. My Web.Config is not so small so I integrated Kigg's into mine with the steps below:
14.a) Copy all non-duplicate configSection elements from the Kigg Web.Config file's configSections element into your Web.config files's configSections element.
14.b) Copy the dependencyResolverTypeName from the Kigg Web.Config file's appSettings element into your Web.config files's appSettings element.
14.c) Copy the KiggDatabase connection String from the Kigg Web.Config file's connectionStrings element into your Web.config files's connectionStrings element.
14.d) Copy the loggingConfiguration, exceptionHandling, cachingConfiguration, unity and assetSettings elements from the Kigg Web.Config file's root element into your Web.config files's root element. Should your web.config already contain these elements, good luck adding the contents of the duplicate element to its respective element in your Web.config.
**14.e) Copy the non-duplicate elements from the Kigg Web.Config file's compilation\assemblies element into your Web.config files's compilation\assemblies element.
14.f) Copy the connectionMangagement, settings and mailSettings (If not already configured) elements from the Kigg Web.Config file's system.net element into your Web.config files's system.net element.
***14.g) Copy the caching, customErrors, globalization, machineKey and sessionState elements from the Kigg Web.Config file's system.web element into your Web.config files's system.web element.
****14.h) Copy the KiggLogin form element from the Kigg Web.Config file's system.web\authentication element into your Web.config files's system.web\authentication element.
14.i) Copy the non-duplicate elements from the Kigg Web.Config file's system.web\httpHandlers element into your Web.config files's system.web\httpHandlers element.
*****14.j) Copy all non-duplicate elements from the Kigg Web.Config file's system.web\pages\namespaces element into your Web.config files's system.web\pages\namespaces element.
14.k) Copy all non-duplicate elements from the Kigg Web.Config file's system.web\pages\controls element into your Web.config files's system.web\pages\controls element.
15. Ensure that your database does not contain the tables: Category, CommentSubscription, KnownSource, Story, StoryComment, StoryMarkAsSpam, StoryTag, StoryTag, StoryView, StoryVote, Tag, User, UserScore and UserTag or the functions: CommentSearch and StorySearch.
16. Open the Create.sql script from Database Folder (e.g. C:\Projects\KiGG\Database\Create.sql), delete the first two lines and change the first line to your database name and run in SQL Management Studio.
17. Open the Data.sql file from the Database folder (e.g. C:\Projects\KiGG\Database\data.sql), change the first line to your database name and execute to populate some tag/category.

* The only thing I can foresee that could be a problem with setting the Kigg AssemblyInfo.cs file's Build Action to None is the GUID attribute for the assembly will be my own. Will that pose a foreseeable problem?
** Needed to change System.Web.Abstractions and System.Web.Routing versions from 0.0.0.0 to 3.5.0.0.
*** system.web\sessionState breaks my site's authentication.
**** I am already using .YAFNET_Authentication from the YetAnotherForum open source project and cannot use both.
***** Was recieving configuration error: System.Web does not contain the Mvc namespace (or something to that effect) so I commented out the System.Web.Mvc and System.Web.Mvc.Html namespaces.

Another option I am considering is integrating an pre-MVC version of KiGG. If it comes down to it, is there a list of critical bug fixes and features I could reimplement since the change?

Also, not to look a gift horse in the mouth or anything, but was switching over to MVC the wisest move for an open source project? You've developed a very cool and useful application and I can't imagine that I'm the only one that requires it to be integrated into an existing project. I'm going to be very disappointed if I have to scrap adding KiGG as a feature altogether because of the fact that MVC was designed with absolutely no backward compatibility in mind, and that is just a little cruel to tease people like that don't you think?