[RESOLVED]Webpages (Razor) Framework/Best Practice

Hey guys,

I think this is more of an opinion based question but I am wanting to find ways of writing my web projects better. I have been looking at this: http://webmatrixhelpers.codeplex.com/

This looks like a nice transition into a MVC, seperating logic and UI. Ultimately I want to have a frame work that I can use as a starting point for my web projects, that is secure and flexible. Does such a thing exist? Or am I best to play with the Webmatrixhelpers
project and use that as a starting point?

Cheers!

It’s an interesting project which seems to have been released to support version 1 of the Web Pages framework. I’m not sure how it would reduce the amount of work you would need to do to port a web pages app to MVC. Ideally, your logic should already be
separated from the UI in a separate code block at the top of the file. 

a-rad

I am wanting to find ways of writing my web projects better

Can you put your finger on the specific areas where you don;t feel you are doing things as well as you could?

Mikesdotnetting

It’s an interesting project which seems to have been released to support version 1 of the Web Pages framework. I’m not sure how it would reduce the amount of work you would need to do to port a web pages app to MVC. Ideally, your logic should already be
separated from the UI in a separate code block at the top of the file. 

a-rad

I am wanting to find ways of writing my web projects better

Can you put your finger on the specific areas where you don;t feel you are doing things as well as you could?

You are correct in that the majority of my logic is placed at the top. Sometimes I add additional code within the page (for example, within a foreach loop.. I might replace a text value with an image, etc).

I would like to really consolidate the basics and these are few things I need to start adding to my applications:

- Validation: I use alot of a UrlString to which I haven’t added any validation if there value is null (for example).. Likewise with forms, I have some validation but I think I could be doing it better.

- Using more Razor for forms and tables: at present I add a foreach loop to draw the rows – does this really matter?

I know back in my PHP days, there were various frameworks you could use and adopt for your projects. I guess I was seeking something similar – Ideally a nice way to present all my code and ensure there is some continuity?

Any thoughts?

Cheers!

Similar to my original posts – I have seen articles like this: http://blog.stevelydford.com/2011/05/creating-a-data-access-layer-using-dynamics-in-webmatrix/

What are the pros and cons to separating the logic from the pages? Would this allow for an easier transition to MVC? 

For what I do, I am happy using Webpages over MVC providing it’s the most efficient way of loading my application’s pages :)

a-rad

What are the pros and cons to separating the logic from the pages?

Pros:

It allows your code to be reusable. For example, you might get a list of products for a dropdown in 5 pages. Rather than write that method 5 times – once for each page – you write it once centrally and call it from your 5 pages.

Potentially it might help with a transition to MVC, but you wouldn’t use the Database helper in MVC.

Leave a Reply