ASP.Net MVC Preview 2 with Delphi 2007

by John 3/12/2008 9:13:00 PM

I have just started exploring preview 2 of the new ASP.Net mvc framework with Delphi 2007.  I have created a project template to help me get started, I'm guessing other people might like it so I have uploaded it to CodeCentral and it can be found here.

If you decide you would like to give it a try your going to need to have installed a couple of things beforehand.

ASP.Net MVC Preview 2 and

the dotnet framework v3.5 

You need to extract the copy of the zip file in codecentral to some location on your harddrive and add ASPNETMVC.bdstemplatelib as a template reference to the IDE. The zip file contains a starter project.

I have more information about project templates here

 

Once installed into the IDE you should be able to select ASP.Net MVC WebApplication from the new items dialog.

This is shown below

 

The project template is based on the existing ASP.Net web application one with a few changes.

The most noticeable difference is that I have created three folders, models, controllers and views.  Its a good idea to head over to the asp.net mvc website to gain an understanding of the conventions followed when using the mvc framework.

Another less obvious change is that the two aspx files in the views subfolders are derived from ViewPage in the System.Web.MVC namespace.

Below is a sample project created with the template.

 

The next two screenshots show the designer and codebehind for the view home.aspx 

Notice the class that the page is derived from

 

The final changes are the addition of a Global.asax to the project and a few updates to web.config

Update:

Below is an example of MVC Contrib using the Brail View Engine

 

 

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

MVCContrib | aspnetmvc | ASP.Net 3.5 | Delphi | Brail

Related posts

Comments

3/15/2008 5:56:51 AM

Wonderful post, except the title. It should be CodeGear RAD Studio 2007. IMHO, Delphi 2007 refers to Delphi 2007 for Win32 which does not contain Delphi for .NET personality.

Lex Y. Li

3/23/2008 9:20:17 AM

http://

How can this be modified to be used with asp.net & ECO?
Venkatesh

http://

3/23/2008 8:20:37 PM

http://

I would create a new ECO webform application with the model in a separate package. Then move the ecospace and persistancemapperprovider into the model package.

Finally replace the asp.net web application with a project created using the aspnet mvc project template.

When your developing functionality you follow the pattern used in my eco mvp example.

http://

3/27/2008 1:22:47 AM

How MVC Contrib library can be used with Delphi 2007?
There's lots of stuff based on extension methods and lambdas which is just not supported in Delphi 2007.

It would be great to see an example translated to Delphi.

For example, how routing and ActionLink Helper can be used in Delphi (weblogs.asp.net/.../...ork-part-2-url-routing.aspx).

This is one of the most important things but in Delphi it might be worthless.
For example, how is it possible to generate typed link with ActionLink this way:

Html.ActionLink("Search Drinks", s=>s.Results("Juice", 2))

So generating a template is just not a prove of ability to use ASP.NET MVC with Delphi.

Castle MonoRail should be much more suitable for using with Delphi until it will start supporting .NET 3.5 features.

Nevertheless, it's a good start.

Dmitriy Nagirnyak

3/27/2008 2:40:21 AM

Hi John,

It's nice to see the blog updated.

I don't see a problem in using Brail or NVelocity engines (supported by MVCContrib).


I also don't see a problem *creating* routes in D2007.

I rather see problems in *using* all the extensions already available in MvcContrib (particularly for routes, which are becoming a part of .NET core).

Maybe with Delphi Class Helpers it would be possible to overcome it, but I'm really not sure.

It seems for me that ASP.NET MVC without Extension methods and Lambdas (which probably is the case with D2007) is just a MonoRail.
Which is much more mature and stable than ASP.NET MVC (at this moment is Preview 2).

What do you recon about MonoRail?

Looking forward for more articles about Delphi + MVC from you.

BTW, you can add your 2 cents about MVC Framework here:
dcportal.argocomputing.com.au/CompleteForm.aspx:115

Regards.

Dmitriy Nagirnyak

3/27/2008 3:13:13 AM

http://

Dmitriy,
I've updated the blog post to include an example of the Brail View engine that was ported from the mono project and sits inside mvccontrib.

I've been creating routes using property assignments. For example

blogPosting:=Route.Create('blogs/johnmoshakis/archive/{year}/{month}/{day}/{*title}',MvcRouteHandler.Create());
blogPosting.Defaults:=CreateDefaults('BlogPost');

blogPostingContraints := RouteValueDictionary.Create;
blogPostingContraints.Add('year','\d{4}');
blogPostingContraints.Add('month','\d{2}');
blogPostingContraints.Add('day','\d{2}');
blogPosting.Constraints:=blogPostingContraints;
collectionOfRoutes.Add('postings',blogPosting);

I don't think it would be possible to use the extension methods but I would imagine you could do something similar with Delphi Class Helpers.

http://

Comments are closed

Powered by BlogEngine.NET 1.3.0.0
Theme by Mads Kristensen

About the author

Name of author John Moshakis
I'm a software developer living in Toronto..

E-mail me Send mail

Calendar

<<  December 2019  >>
MoTuWeThFrSaSu
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Authors

    Tags

    Don't show

      Disclaimer

      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      © Copyright 2019

      Sign in