Design Patterns

Dependency Injection for Filters in MVC3

One of the new features of the Dependency Inject (DI) components from MVC3 is something called a IFilterProvider.  The purpose of this component is to provide a simpler way for MVC applications to interact with filters (action, exception, result, etc.). In the previous versions, trying to achieve something like providing DI support to filters was doable, it just required deeper integration into the MVC runtime.  The IFilterProvider interface is defined as: As you can see, it’s a pretty simple interface that can enable lots of opportunities if used in the right context.  The MVC bits ship with an...

posted @ Tuesday, October 12, 2010 11:37 PM | Feedback (26)

FubuMVC Conventions in ASP.NET MVC with MVC Turbine

Great minds think alike … or is it that fools seldom differ? I forget… In any note, all I can say that in this case it took three people’s work to make this possible in order to bring simplicity to the masses. Please note that this piece is a work in progress and we’re still trying to figure out how things will be at the end for these two frameworks to interact. Also, if you want more code, I suggest you check out the Fubu sample for MVC Turbine. What does it all mean, Basil? I’m not going...

posted @ Thursday, April 15, 2010 12:08 AM | Feedback (3)

Why MVC Turbine?

I would like to thank Rob Conery for posing the question: As the project’s portal states: MVC Turbine is a plugin for ASP.NET MVC that has IoC baked in and auto-wires controllers, binders, view engines, http modules, etc. that reside within your application. Thus you worry more about what your application should do, rather than how it should do it. Let’s see how this plays out for your application… Plain Old MVC Application If you create an MVC application by using File –> New, you get the full power of the MVC framework but your application is not yet setup to take full advantage...

posted @ Thursday, December 31, 2009 12:14 AM | Feedback (5)

Injecting Your Favorite IoC Into MVC Turbine

Since the release of MVC Turbine, I’ve been getting lots of questions about the design decisions I made around the interaction with the Service Locator that ships with the plug-in.  The two main questions are: Why didn’t you use the Common Service Locator project from CodePlex? Why are we forced/constrained/etc to use generic component registration API? These questions are very valid and could be easily explained if I ever write the documentation for the project (which, I’m working on by the way). So in this post, I hope to...

posted @ Tuesday, December 15, 2009 1:39 AM | Feedback (4)

ASP.NET MVC Embedded Views with MVC Turbine

I’ve blogged in the past about the extensible component model for MVC Turbine, this post is a continuation on that concept, except with views as embedded resources. Virtual Path Provider: The Secret Sauce Not sure how many of you know this, but a VirtualPathProvider (VPP) is a way to provide the ASP.NET runtime with resources from a virtual file system. In other words, you can provide files such ash web forms, scripts or anything else that’s served to the ASP.NET run time to process.  To learn how to this more in detail, check...

posted @ Monday, December 7, 2009 10:58 PM | Feedback (9)

MVC Application Extensibility with MVC Turbine

The whole purpose of MVC Turbine is to make the development of an MVC application easy and streamlined. This can be done through the use of a new feature of V2 called “Blades”. Essentially, a Blade is nothing more than a component (or slice) of a Turbine application since it provides a layer of abstraction to a concern of the application. For example, a Turbine MVC application ships with three core blades out of the box: MvcBlade – Performs all ASP.NET MVC related work, i.e., setup of Controller factories, View Engines, etc. ...

posted @ Tuesday, November 3, 2009 11:32 PM | Feedback (8)

Mvc Turbine v2 RC

That’s right, get the v2 RC release while it’s hot!  Version 2 of MVC Turbine, is a complete re-write of the plug-in that allows these features: New runtime framework that allows extensibility Blades (components) that are auto-registered and loaded at runtime. Introduced the Core Blades to setup the basic runtime of an MVC application: MvcBlade -- wiring for MVC related components (Controllers, View Engines, etc). ...

posted @ Friday, October 30, 2009 10:40 PM | Feedback (7)

MVC Turbine

For those of you that follow me on twitter, you’ve noticed that I’ve been tweeting a lot about a new side project called MVC Turbine. MVC Turbine is a simple way to provide flow and plumbing within ASP.NET MVC applications, or as its tag line suggest, it converts flow into useful work.  A few weeks ago, I had a quick poll on twitter that asked: As you can see, from the results, 50% of the responses where “Yes, always!” which means that you’re wanting more out of your MVC application. Please, don’t get this the wrong way: I’m not saying that Phil...

posted @ Friday, September 25, 2009 1:55 PM | Feedback (2)

Autowire IHttpModules with IoC

My original title for this blog post was going to be HttpIoC - Find Out What It Means To Me, as Steven Smith suggested via twitter, but I figured it wasn’t going to be as searchable. :) So I went with the boring title. Sorry Steven! A while back, Tuna Toksoz and I were having a conversation on twitter about how he does registration of any modules his application will need/use.  After playing around with the concept for a little, I was able to get something that will work for our any ASP.NET application with minimal effort. ...

posted @ Wednesday, August 19, 2009 10:45 AM | Feedback (12)

Inferred Controller Actions

I know I’ve been quiet for the past couple of weeks, so hopefully this post makes up for some of the silence. :) A while back, I voiced my opinion on how actions within should be small and to the point. After this post, I started to think on how we can make ASP.NET MVC do more for us based on a convention.  Take the following code as example: 1: [HandleError] 2: public class HomeController : Controller 3: { 4: public ActionResult Index() 5: ...

posted @ Tuesday, August 11, 2009 11:28 PM | Feedback (5)

miniurl – ASP.NET MVC URL Redirection Sample Application

Not sure how many of you out there use a URL redirection service such as tinyurl, is.gd or snurl. They come very handy when you’re trying to take a long url like: http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=des+moines+iowa&sll=37.0625,-95.677068&sspn=44.879582,87.714844&ie=UTF8&z=12&iwloc=A Into something that's a bit more manageable: http://tinyurl.com/nzqn5f How can you do this within your ASP.NET application? Well, check out miniurl on CodePlex. :) What is miniurl? The miniurl MVC application is a very simple example on how to use MVC and URL Routing to create a URL Redirection service. That means you’re...

posted @ Sunday, July 5, 2009 10:36 PM | Feedback (5)

What's in a controller? That which we call an action…

Recently, fellow MVP and ASPInsider, Jeffrey Palermo blogged a pretty interesting idea called ActionController.  Within his post, he states: My interest in this space is purely practical.  I really don’t care how patterns are published.  I don’t care about “being true” to the MVC pattern or any other pattern.  I’m more interested in being effective with web applications on .Net.  After have experience with MvcContrib, CodeCampServer, and a much larger ASP.NET MVC implementation (200+ screens), I have come to see how controllers end up searching for an identity.  What is a ProductController anyway?  That’s just about...

posted @ Saturday, June 20, 2009 11:58 PM | Feedback (14)

Contextual Sessions with NHibernate – Part 2

In my previous post, I talk about how the problem with sessions and NHibernate (NH) can get pretty tricky to deal with; specially within ASP.NET web applications.  This post shows how you can use a pretty nice feature within NH that simplifies this problem. A Solution NH supports a mechanism of providing a ‘current’ session via the ISessionFactory.GetCurrentSession method by using a concept called Contextual Sessions.  This is what the NH documentation says about the feature: Most applications using NHibernate need some form of "contextual" sessions, where a given session is in...

posted @ Wednesday, February 18, 2009 4:26 PM | Feedback (62)

Contextual Sessions with NHibernate – Part 1

As with any piece of software development, there is more than a million ways to skin a cat.  Working with NHibernate in a multi-threaded environment is no different. :)  To help with the illustration of the interaction of NHibernate and ASP.NET, I’ve created a sample application out on Google code.  Please feel free to check it out and run it locally.  The only requirement for the sample is to have a local install of SQL Server Express. The Problem Those of you using NHibernate in a multi-threaded environment (say ASP.NET) have probably written code to maintains an ISession...

posted @ Tuesday, February 17, 2009 8:56 PM | Feedback (7)

Etixo

As some of you already know, I blogged about my reaction to the Oxite MVC sample from the MIX Online Labs.  Also, I started blogging some of my ideas for refactoring the source to make it a bit more streamlined.  More importantly, I want use these posts as a way to share my ideas on how to use the new ASP.NET MVC framework.  Not that I am “the source” for the right implementation, but I do want to provide another insight to the problem.  Anywho… Instead of keeping my source in zip files and bits and pieces, I created a fork...

posted @ Sunday, January 11, 2009 10:59 PM | Feedback (4)

Views, Models and ViewModels - Part 1

Not sure how many of you read my first post on my thoughts on Oxite. Well, here's my offering on trying to make things a little closer to MVC by offering my perspective on the code.  Please note that I want to keep these simple refactorings as conversational as possible, so if you see something that offends or upsets you with my interpretation/implementation, PLEASE COMMENT. :) Let's examine the SignIn action under the AccountController: [AcceptVerbs(HttpVerbs.Post)] public ActionResult SignIn(string username, string password, bool rememberMe, string returnUrl) { PageTitle.AdditionalPageTitleSegments = new string[] { "Sign In" }; ...

posted @ Tuesday, December 23, 2008 10:56 PM | Feedback (3)

Visual Studio Templates for MVC Views without Codebehind Files

For those of you doing MVC out there you've probably noticed that every time you create a new view within your project, the template that VS uses creates a both a .aspx.cs and a .aspx.designer.cs file for your view.  A group of mvps/insiders have been talking about this topic for a bit.  A small group of us feel that providing this file is a temptation that can lead to world of hurt. To us, the this code behind file is a honeypot asking for bad practices.  The fact that you have a codebehind file and that you can put...

posted @ Monday, October 20, 2008 4:23 PM | Feedback (10)

Thanks, VSLive Las Vegas and HDC Omaha '08!

For those of you that attended one or both at of my talks at VSLive Las Vegas or HDC Omaha 2008, I just want to say, thank you!  And for the VSLive folks, I do apologize for cutting my open source tools talk short by 10 minutes.  I had to jet out of the Mirage so I can make the plane back to the Midwest! As promised, I upgraded my code to run with Beta 1 of the ASP.NET MVC Framework!  So, if you want to get the latest bits go to: http://jglozano.googlecode.com/svn/trunk/presentations You will find my slide deck as well as...

posted @ Sunday, October 19, 2008 7:05 PM | Feedback (0)

ASP.NET MVC CTP Download

Well, we can finally get our hands on the ASP.NET MVC bits!  They're being released as part of the ASP.NET 3.5 Extensions CTP.  This release includes: ASP.NET AJAX Improvements: New ASP.NET AJAX features in the ASP.NET 3.5 Extensions release include better browser history support (back/forward button integration, and server-side history management support), improved AJAX content linking support with permalinks, and additional JavaScript library improvements. ASP.NET MVC: This model view controller (MVC) framework for ASP.NET provides a structured model that enables a clear separation of concerns within web applications, and makes...

posted @ Monday, December 10, 2007 9:14 AM | Feedback (6)

Tulsa TechFest: Unable To Present

I would like to apologize for those who wanted to attend my presentation on Software Factories at Tulsa TechFest, but unfortunately due to technical difficulties, I missed my stand-by flight into Tulsa.  When I spoke with the nice people at American Airlines they couldn't guarantee me making into Tulsa into sometime late this evening. However, for those of you wanting my slides, you can download them from the link at the bottom of this post.  Also, as I mentioned on my HDC post, I will be doing a webcast series on the Software Factories on Code To Live.

posted @ Friday, October 19, 2007 2:17 PM | Feedback (4)

Software Factories at Heartland Developer Conference

First, to all of you that attended my HDC presentation on Software Factories, THANK YOU!  I hope that as promised, the "Ah, Ha!" factor was high.  Also, I would like to apologize for the issues I ran into with the VPC and the demos.  I had tried the demo before with only two VS2005 instances running and had no issues with it...Apparently, four instances of VS2005 running concurrently is too much for VPC. Right after my presentation, I confirmed with Steve Loethen, a co-host of Code To Live, about coming up with the webcast series on Software Factories. I still to work out...

posted @ Thursday, October 18, 2007 8:01 PM | Feedback (2)

How Many Classes Does It Take To Fully Represent A Real World Object?

Anybody?  Let's start this conversation and see where it goes?  David, I'm really interested on what you have to say about this!

posted @ Friday, July 27, 2007 12:46 PM | Feedback (4)

Heartland Developer Conference, I'll be there. Will you?

That's right, I received word from Phil Wolfe earlier this week that I've been accepted to be a speaker (this is my third year!) for the Heartland Developer Conference in Omaha, NE on Oct. 18-19th.  If you check out the speakers page, you won't see my info there but I'm sure it's coming.  For those of you that like my presentations,  here's a list of topics I've been kicking around: .NET Tooling for Oracle - There's some applications out there that need talk with Oracle.  How do I make things as easily as possible to get my work done?...

posted @ Friday, June 15, 2007 11:43 AM | Feedback (0)

TDD, I Think I Love You

So, a couple of days ago while sitting at the lobby of my hotel for the MVP Summit, I decided to come up with a simple Smart Client shell for the LOB Windows application my company uses. So there I am minding my own business when along comes Jean-Paul Boodhoo, James Kovacs, David Laribee, DonXML and ask what I was working on.  After some explaining of my intentions for replacing our legacy VB6 application with a brand new .NET one, JP couldn't resist the opportunity to do some TDD and Pair Programming. I must say, that I've always been of the...

posted @ Saturday, March 17, 2007 9:52 PM | Feedback (0)

Architecture: Why Use Workflow Foundation?

I was asked today if there's a metric for determining whether an business application should use Windows Workflow Foundation (WF) or roll its own workflow plumbing.  Here's my extended answer... As far as a metric of qualification, I can't say there is one (or that I have found one).  Besides deciding whether or not to  use a technology (or any type of plumbing) as an aide for development can't be (and shouldn't be meausered) by a number.  It's not the number of lines of code, methods, classes, assemblies, etc. that decide whether or not you should use workflow.  It all comes down to...

posted @ Monday, February 26, 2007 9:44 PM | Feedback (4)

IList<T> or Collection<T>?

Not sure how many of you guys have experienced FxCop Rule# CA1002 : Do Not Expose Generic Lists through out your coding ventures.  I'm not sure what to think of it... In one hand, I see the flexiblity of returning the IList<T> type since there could be x-number of things that could implemented.  Thus not tying me up with a specific implementation such as List<T> or Collection<T>.  On the other, Collection<T> does allow you to override functionality and also implements IList<T>. The rule does mention that List<T> (IList<T>) is designed for performance and Collection<T> is designed for inheritance... What are your thoughts on...

posted @ Wednesday, November 29, 2006 1:09 PM | Feedback (8)

PDD: Procedure Driven Design

<sarcasm:MyReality> This is the lesser known of the *DD approaches for design and development.  Essentially, all logic lives within your stored procedures (sprocs) within your database.  And by "all logic", I mean, ALL LOGIC. That's right, ALL validation, business rules, persistence, workflow, etc. resides within sprocs that interact against your database. What makes it challenging is when you try to implement some object oriented techniques with a strictly procedural language.  That's what I call, "exercising your tech-muscle." </sarcasm:MyReality>

posted @ Tuesday, November 21, 2006 8:25 AM | Feedback (1)

Design By Committee

http://en.wikipedia.org/wiki/Design_by_committee What's your take on it?

posted @ Monday, November 20, 2006 2:05 PM | Feedback (21)

Currently Reading

Essential Windows Workflow Foundation This is book is a really, really, really good read.  The authors (both architects of WF) do a really great job of breaking down the concepts of what "makes up" a program...a basic approach they took into consideration when designing WF.  If you're planning on using .NET 3.0, this is a worthy investment.

posted @ Tuesday, November 14, 2006 9:30 PM | Feedback (6)

The Onion

So yestereday I'm reading my daily RSS feeds when I encounter Ted Neward's post on a comment that Scott Hanselman made during the p&p Summit in Redmond.  After reading this post, I shot Nick a message asking him to read it and see what his toughts were on this...you can find his response here. I couldn't agree more with Scott, Ted and Nick.  Here's why ... In my old Java dev days, we utilized a lot of open source technologies (Http Commons, log4j, Bouncy Castle, etc.) to help speed up our writing of code (just as Scott did with log4net).  The company I...

posted @ Wednesday, October 18, 2006 1:28 PM | Feedback (2)

SOA and Reuse Opinari

David Chappell has posted his latest opinari entitled SOA and the Reality of Reuse.  Over all a pretty good read since it helps to demystify theoretical SOA from applied SOA.  While reading the opinari, I came to the realization that people considering SOA should we asking the question: what are you really trying to do now? As an added bonus, David Ing has posted his own thoughts on the opinari; also a very good read.

posted @ Wednesday, August 30, 2006 6:13 PM | Feedback (1)

Currently Reading

Here’s a list of the books I’m currently reading: Technical – Developer Professional .NET Framework 2.0, Joe Duffy, WROX Press I previously posted about this book...yeah, I'm still reading it. Been busy with the baby. Technical – Architect Applying Domain-Driven Design and Patterns: With Examples in C# and .NET, Jimmy Nilsson, Addison-Wesley I really enjoy reading Jimmy's blog and knew about the book for quite some time. While at BN, I saw it and started reading it. After a while, I realized that I was already halfway done with chapter one. I just had to have it. Pretty great read specially if you're read the PoEAA...

posted @ Sunday, July 23, 2006 11:03 PM | Feedback (0)

Nice Software Factories Write Up

Found this really good write up on Software Factories (SF).  If you have the November 2005 CTP Release for Visual Studio 2005, you can build the sample in the article.  This is pretty good implementation of a SF.

posted @ Tuesday, March 21, 2006 8:59 PM | Feedback (7)

Design Patterns: Yahoo! Style

To me (the web developer) this is pretty sweet.  I like how they apply a design name for features found accross websites.  For those web developers out there, what do you guys think? They should submit these to PatternShare!

posted @ Tuesday, February 14, 2006 8:14 PM | Feedback (10)

IADNUG Meeting Tomorrow

Another IADNUG meeting tomorrow.  Eric Jacobs will present on how Two Rivers uses CodeSmith in their development process.

posted @ Tuesday, January 31, 2006 10:15 PM | Feedback (8)

Enterprise Service Proxies

According to GoF a proxy is a surrogate or placeholder for a another object to control access to it.  The text later goes on to explain that a reason for controlling access to an object is to defer the full cost of its creation and initialization until we actually need to use it.  Makes sense doesn’t it?  A proxy is nothing more than a light weight way of accessing an object (regardless if it lives in the same address space as the caller). Recently, for one of our work projects, we’ve been using a lot of Enterprise Services (ES) in order to...

posted @ Tuesday, November 22, 2005 10:07 PM | Feedback (7)

Dependency Injection (DI) ... Inversion of Control (IoC) ....

Question, is it just me or is this pattern like a declarative abstract abstract-factory (GoF)?  I just got done looking at the MovieFinder example for Spring.NET and that’s what it seemed to me. Any thoughts?

posted @ Monday, August 22, 2005 10:19 PM | Feedback (1)

Principles Of Service Design Articles On MSDN

John Evdemon has posted a series of articles covering different aspects of Service Design.  The first article entitled, Service Patterns and Anti-Patterns covers the basic SO tenants and patterns and anti-patterns for effective web service design.  The  second article, Service Versioning talks about versioning schemas for your web services.  Good reads all around!

posted @ Monday, August 22, 2005 9:18 PM | Feedback (0)