posted 02/19/2009 by Arthur Correa | 0 comments
So I've finally gotten to start working on actually MVC portions of the Blog code.  Lets see how does this stuff work?  Hmm ASP.Net looks at the url coming in and determines the controller and action from the url pretty straightforward. So just as an example here I am at http://www.alwaysmoveforward.com/software/Blog/Post/2009/2/19/My_MVC_Experiment_Part_8_-_Route_Mapping.  How does MVC use this url? Well it starts off by ignoring the first part of the url that contains the site.    Then, by default it looks next for the controller portion of the URL.  It takes that portion of the Url (in this case it says Blog, and looks for a Controller class called BlogController.  ASP.Net will then instantiate an instance of that Controller and try to do something with it. But what does it do?  Well it has to figure out what Action to execute on the BlogController class that it created in the last step.  To do that it looks again at the URL, where a po
full article

posted 02/11/2009 by Arthur Correa | 0 comments
Okay so I'm actually going into my MVC details now.When I first started using ASP.Net MVC I dumped everything into the ViewData dictionary using ViewData[""].  I had noticed the ModelContainer class that is created for you when you first create an MVC project, but honestly why bother?  You can just dump whatever you want into the ViewData at will so why create a bunch of properties on a class?Uhm ok, but lets take the opposite approach.  Why NOT create a bunch of properties on the class.  My opinion was that you'd very frequently have a lot of properties that were on the ModelContainer that weren't used all the time.  As a result a ModelContainer interface that was clutttered with junk whenever you used it.  Sure if you had stuff that was used all the time then it might make sense, but I hadn't yet come across enough commonalities in my code to justify it.So I went on my merry way.  I liked using ViewData[""], but I found it a pain in the view because it wasn't strongly typed.  Having
full article

posted 02/10/2009 by Arthur Correa | 0 comments
What has gone before-I had problems installing blog software with my host, so I decided to write my own.  I sort of force myself to do ASP.Net MVC, and was pleasantly surprised at how much I liked it.  I decided to do it as a multi-blog site just to make life interesting, and then used LINQ and realized that it made life pretty easy. So now that I've described to you the underpinnings of my site.  Here is where I get into the MVC stuff.  There were a few areas that I'll dive into such as How I used ViewData - Essentially it was the debate do I use ViewData[""] or create model classes and pass everything back that way? How I mapped my Routes - Which was largely based around how I wanted to target my different blogs. Where, when and why I used Ajax and how I used it - I tried using the MVC Ajax stuff, but I really didn't care for it.  It didn't feel all that easy to use. How to page my results in my web UI (again, I'm used to Web Forms power What to use for an a
full article

posted 02/09/2009 by Arthur Correa | 0 comments
myself to do ASP.Net MVC, and was pleasantly surprised at how much I liked it.  I decided to do it as a multi-blog site just to make life interesting, and then used LINQ and realized that it made life pretty easy. Ok, so I need some place to put my core business logic and my data access code.  Well I'm using MVC so I could just put my business logic in the Controller, but in my last post I explained why I didn't like that.  So I want to put my business logic in a Manager class.  First I define a Service layer.  Essentially it decouples entities from the Input Interface (whether that be Web app, web service, client app, another internal object, whatever needs to call into that domain logic to do work).   An important thing to note is that these Service classes are stateless. Ok, those are definitely staying.  I need my Business Logic after all.  But what about my Gateway?  The purpose of the Gateway is to encapsulate all o
full article

posted 02/05/2009 by Arthur Correa | 0 comments
What has gone before-I had problems installing blog software with my host, so I decided to write my own.  I sort of force myself to do ASP.Net MVC instead of ASP.Net Web Forms, and was pleasantly surprised at how much I liked it.  Then I went to create my schema and decided to make my life more difficult for myself by having a multi-blog site. So how to architect my system on top of the LINQ generated layer.  Hmm well I'm using MVC.  I could just throw my business logic in the Controller classes.  Its the way they're described as should be done, but I dunno.  I'm not feeling it.  I'd like to be able to have my Business rules completely separate from my UI layer so I can put any kind of interface on top that I want.  WCF Web Service, Windows Form, Silverlight, whatever.  So if I put my logic into the controller, well I'm kind of rooted in the MVC stuff. So lets see, can I use designs I've used in the past?  Why not, should work.  Th
full article

posted 02/05/2009 by Arthur Correa | 0 comments
Yesterday I ran into a couple of problems when I went to upgrade to the release candidate for MVC.  The first had to do with a custom autorization filter I had created for this site.  The second problem had to do with request validation suddenly being enabled. The AuthorizationFilterSome quick background for those not familiar with this method.  I wanted to do my own flavor of request authentication.  So I created a class that derived from FilterAttribute, and from IAuthorizationFilter.Deriving from FilterAttribute allowed my class to function as an action filter (i.e. it can be associated with a controller action and executes when that action executes).  In this case it allowed me to easily added this filter as an attribute in the code as well as allowing the custom authorization filter to execute just before my method was executed so that I could ensure the current user was allowed to execute the method. Implementing the IAuthoriztionFilter interface meant that this filter would run
full article

posted 02/03/2009 by Arthur Correa | 0 comments
What has gone before-I had problems installing blog software with my host, so I decided to write my own.  I sort of force myself to do ASP.Net MVC instead of ASP.Net Web Forms, and was pleasantly surprised at how much I liked it. Ok, so I'm writing my own blog software using MVC.  Sounds good, first lets get a schema going..Ok, blog entry table, a table for tags, a table or comments, throw in a users table, what else?  How about a role table for user roles.  Hmm I guess that's all I techincally need.  Its not much really when you get down to it.  Pfft you know what.  I want to learn more about the ins and outs of MVC and LINQ.  Honestly I don't think five tables are going to really push the envelope there now is it? Tell you what.  Lets make this blogging software that can support mutliple blogs, that's a bit more interesting. Was it neccessary? No, would I just willingly add complexity in my daily job?  Most definitely not.  I pre
full article

posted 02/01/2009 by Arthur Correa | 0 comments
What has gone before - I had some problems installing my blog software so decided to write my own.  Now what do I do?Well my original idea was to implement this using ASP.Net Web Forms, couple that with a little Ajax action, some LINQ, man this will be so sweet I thought.I started playing around with it, and in my travels of reading up on LINQ I came across some MVC stuff.  Hmm interesting, what is the new ASP.Net thing they're talking about.  Looks interesting.  I kind of like the way the files are laid out and how the pattern implementation ties them all together.Wait a second.. Where are my Web Forms?  I'm used to Web Forms, this UI code looks like plain old HTML.  Bah who wants to do plain old HTML I thought.  The heck with that, I'm sticking with my web forms site that I started, couple it with a little Ajax action, some LINQ, its going to be soo sweet.Wait a second, what's that?  MVC is the way of the future?  You mean its not just some fly by night thing that Microsoft is going
full article

posted 01/31/2009 by Arthur Correa | 0 comments
So I wanted to start blogging, no particular reason, I just finally decided I wanted to do it.  I go to my hosting provider, and click on the link to add some blogging software to my site.  You are not authorized to install that... Hmm, let me check.  I have basic hosting, I have the correct hosting platform type, it says I should be able to install it. So I try again. Nope. *Sigh* okay.  Email tech support, "Ok let me take a look" Mr Support responds cheerily.  "It looks like it needs a database instance to exist to install.  Create a database instance and you should be all set." Great ,lets do it!  I create the database, click the link to install Nope. *Sigh* okay.  Email tech support.  "What am I doing wrong."  I ask. Mr. Support cheerily responsds.  "Your blog software needs a database instance.  Make sure you have one created."  "Uhmm, ok" I say, "but I do have an instance." "Well then that must be the problem.&
full article



1234567
891011121314
15161718192021
22232425262728
2930311234
567891011