Over the last month or so I've been working on an Add-in for Visual Studio 2008 which will generate scaffolded Views and a Controller using Linq To Sql. I took my time with it as I wanted to leverage all of the goodness that I've learned from the MVC Storefront, and as of today I think it's ready to see the light of day.
This is a Prototype
Visual Studio may crash when you use this (hopefully not - I think I have it fairly stable). I've really tried to focus on "robustness" here but I'm not an "Addin Guy" per se. These bits are prototypes but "they work on my machine" so hopefully you will find this useful.
The goal of releasing this right now is to get your feedback. I'd like to see if I can answer some questions right up front, however:
You can download the Addin Here (MSI Installer). I will be updating this a lot - so you may want to check back from time to time.
UPDATE: Scott Hanselman called to let me know that my installer is assuming that Addins go in [PersonalFolder]\Visual Studio 2008\Addins and for him, that's not the case. So I've uploaded a "binaries only" zip that you can get here - just unzip and drop into your Addins folder, wherever you put it.
UPDATE 2: My MSI Installer, for some reason, was not including a required DLL. This was fixed as of 10/7/2008 2:40 PDT and reloaded.
Many thanks to anyone who wants to test-drive this for me. And if you'd like to know what it does and what it is, here's (as usual) a video walkthrough (double-click for full screen, or download the video here)
Points to anyone who knows the soundtrack :).
Not being a LinqToSql fan ... I look forward to your SubSonic implementation. Hopefully that is coming sooner than later. Any ideas on when we could expect it would be nice.
That brings a question to mind: Can this be extended by folks to create an implementation for whatever ORM they want? For example, can I create a plug in NHibernate?
Thanks again
oh, and nice work!
I have it in a diff project, but its def. in here.
any ideas?
Have been watching all the MVC web casts and have learned a lot. But I am a worried for the future of L2SQL, are you to?
Thanks,
Trevor
Great idea with using IAuthenticationService in the accounts controller.
Big +1 on the Mailer - I find most sites send emails so why not include it.
+1 on the logging too - I have not coded a site that does not have logging.
I like that DI is in there by default but is MSFT going let that fly (as opposed to using Unity etc).
I usually find that I end up with at least 2 base controllers - one for public (PublicController) stuff and one for "members" (MemberController) with the main difference being authentication etc. Not a big thing but if we include authentication by default...
One biff - I hate seeing the "aspnetdb.mdf" db in the app_data folder - it's fine for development land but a long way from deployment. I would prefer to see setup scripts etc (I know there is aspnet_regsql.exe but again there's a bit of a disconnect with the sites code).
All other bits I passively agree with!
BTW, nice job ;-)
(PS, check line 11 of Site.Master and the MasterPageFile path in Error.aspx)
I will start to use it tomorrow morning.
Very cool stuff
very cool stuff Rob.
To resolve the script problem, we need to create a folder in the "content" folder, called Scripts.
If this was a fresh solution, all will be well. If we have run the "bad" addin code against the solution tho, there would now be a problem, because the code will have created the "app" folder on the disk, but not added it to the solution.
To resolve the Repository problem, check to see if the "app" folder exists off the root of the solution (show all files button in the Solution window taskbar in VS2008), and if it does, include the "App" folder in the solution and save the solution.
Run the scaffold generator from the context menu, it should now work.
Hope this helps.
I see the subsonic dialog pop up for a split second, then it crashes the IDE.
Copy the above file from C:\Program Files\SubSonic\SubSonic Makai folder, into your Addins folder, mine was in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Addins ... once it's there, the whole process should work and you will get the scripts folder populated with the right script files also.
Hopefully Rob will put a version up that puts this file in a suitable place, my guess is this is an OS-version based problem, only happening to folks on just the right (wrong) OS release.
I've uploaded the changed bits.
2-)Like mentioned aboce ICSharpCode.SharpZipLib.dll is not copied to addins folder (in my case under Vista)
3-)Also mentioned above you need to create Scripts folder manually before using it
I have a couple of questions regarding how, if at all, a couple routing features available in Rails are available in ASP.NET MVC ... and if so, are they supported by your custom ViewEngine in the template.
* Nested Routes
In Rails we can, for example, nest comment resources inside a post resource simply by specifying something like "map.resources :posts, :has_many => :comments" in our routes.rb. Is this feature supported by ASP.NET MVC and if so, is it supported by your template?
* Namespaced Routes
In Rails we can create namespaced routes by running something like "./script/generate controller Admin::Posts" and modifying our routes.rb file to look like this:
map.namespace :admin do |admin|
admin.resources :posts
end
This results in the following directory structure ... /views/admin/posts giving us the ability to lock down anything in admin to the "admin" role and allowing "admins" to work with Post resources differently than regular users. Is this possible with ASP.NET MVC and supported in your template as well?
If nested routes and namespaced routes aren't supported ... I'd be curious to know what is the recommend practice for producing the same funtionality in ASP.NET MVC.
Thanks again!
Also, there's something funky about your css (a guess) that causes field labels of drop down boxes on edit and new pages to appear and disappear depending where they fall on the page. Scrolling the page or shrinking the height of the browser causes them to appear or disappear.
Any chance of updating it to the latest MVC version?