External Resources
Links to external resources providing tutorials on Enterprise Library, Repository Factory, Smart Client Software Factory, and Web Client Software Factory.
Two weeks ago I blogged about a new MVC (Model View Controller) framework for ASP.NET that we are going to be supporting as an optional feature soon. It provides a structured model that enforces a clear separation of concerns within applications, and makes it easier to unit test your code and support a TDD workflow. It also helps provide more control over the URLs you publish in your applications, and can optionally provide more control over the HTML that is emitted from them.
Read More
MVC is a framework methodology that divides an application's implementation into three component roles: models, views, and controllers. "Models" in a MVC based application are the components of the application that are responsible for maintaining state. "Views" in a MVC based application are the components responsible for displaying the application's user interface. "Controllers" in a MVC based application are the components responsible for handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI. In a MVC application the view is only about displaying information - it is the controller that handles and responds to user input and interaction.
Read More
I got a comment on one my previous post “ASP.Net MVC Framework - Exception Handling” that the Rescue style MonoRail is a nice solution to handle Exception thrown within a Controller. In this post I have added something similar to as the Rescue feature of MonoRail (at least I think so ;)) where an attribute can be added to a Controller or on an Action. The attribute can be used to specify which View that should be rendered when an exception is thrown. We can also specify different Views based on different exceptions...
Read More
By implementing my own IrouteHandler I changed the pipeline to support Interceptors before and after an action is invoked...The Interceptors has two methods, PreHandle and PostHandle. The PreHandle returns a value if the process of a request should be stopped or if it should go on with the process of an execution. It’s possible to create a chain of Interceptors. If more than one Interceptor is specified and one of them tells to stop the process, the rest in the chain will not be executed. To specify an Interceptor or a chain of Interceptors I have override the Route class and created my own which has a List of IInterceptors...
Read More
The RouteHandler in this post will replace the IControllerFactory with my own Controller Factory, and also set a default ControllerFactory and a ViewFactory specified in the web.config. This is something the current preview bits of the MVC Framework can’t. It’s quite easy to create our own RouteHandler, we only need to implement the IRouteHandler interface and implement the GetHttpHandler method...
Read More
I will go on by showing how we can create a simple Blog application with the ASP.Net Framework and LINQ to SQL. To create a MVC Web Application we select File -> New Project and select the MVC Web Application template. The Controllers folder should contain the Controllers we will use in our application. In the Models folder we put our model and business objects. In a larger application we will probably use separated class libraries instead of adding the objects to the web application project, this is of course possible. In the Views folder we add the pages (Views). The Views have the responsibility to render the Model. A View is a normal .aspx page, but instead of inheriting the Page object, it inherits the ViewPage object or ViewPage<T>. We can also put MasterPages and Style Sheets into the View folder.
Read More
As many of you already know Microsoft is working on a MVC Framework for ASP.Net. MVC stands for “Model View Controller”. The Model View Controller is a design pattern and the idea is to separate business logic from the View (The View is the page that will display content, for example an .aspx page). The MVC in general maintain a clean separation of concerns, it will be easier to test business logic because it’s separated from the View and the View will not have any knowledge of the underlying model.
Read More
AjaxController is a class I added, and it introduces a new property IsAjaxRequest, which I can use in my action methods to do things like render different views. It also introduces members such as RenderPartial, which can be used to render a portion of the user interface defined within a partial view as opposed to the full page. So here is my updated controller and the updated Add method with the changes and additions in bold.
Read More
Stated goals of the ASP.NET MVC framework are: Enable clean separation of concerns, Be testable by default, Support Inversion of Control (IoC) containers and third-party view engines, Support customization of URLs, Leverage existing ASP.NET features, and Support static and dynamic languages.
Read More
See the presentation of the ASP.NET MVC Framework by Scott Gutrhie at the ALT.NET Conference. What is really impressive is the pluggable and extensible nature of the entire framework: 1) Pluggable View Engines - ASPX, NVelocity, Brail, etc., 2) Pluggable Dependency Injection - Windsor, Spring, etc., 3) Controllers - IController, ControllerBase, Controller, or create your own., and 4) Routing Engine - Use default or create your own engine to map URL's to Controllers.
Read More
Use the ServerSideValidationExtender with the ASP.NET CustomValidator Control to provide AJAX-style server-side validation on the client. The ServerSideValidationExtender is a new control in the Validation Guidance Bundle in the Web Client Software Factory v2.0.
Read More
The Repository Factory ( and most software factories ) have a needless dependency on Enterprise Library which makes it difficult to use with clients who already have their own infrastructure layer services. I fixed that for a client by applying simple design patterns that made Enterprise Library a provider as opposed to a dependency.
Read More
I created a completely pluggable version of the Repository Factory that does not require Enterprise Library and has an improved Enterprise Library GUI Plug-In to support pluggable database providers.
Read More
You can successfully use the Data Access Guidance Package in the Web Service Software Factory to successfully generate a data access layer in a Web Client Software Factory Solution.
Read More
At some point during your development you may change the name of your assemblies / modules being built using the Web Client Software Factory. Maybe you decide to change the name of the assembly Shell to MyCompany.CoolApp.Shell.
Read More
Whenever you want to change service providers for a service you need to modify source code, recompile, and publish the changes to the production environment. This limitation is counter intuitive to all the changes you see happening in ASP.NET, Enterprise Library, and the .NET Framework where you have the ability to swap out providers via a configuration file without having to touch source code and recompile.
Read More
The Microsoft Patterns and Practices Team did a Web Client Software Factory Webcast that you can view on-demand. It is a decent introduction, but really just reinforces what I already know from presenting the Web Client Software Factory at both the South Florida Code Camp and Orlando Code Camp - the Web Client Software Factory is difficult to present in only 60 minutes.
Read More
The Web.config files in your Web Client Software Factory applications play a huge role during application startup. During startup, the Composite Web Application Block reads all the Web.config files throughout your website to create a list of all Modules ( Business Modules and Foundation Modules ) and their dependencies. The modules registered in the Web.config files then get initialized and loaded into the web application. Here is how it works and the benefits...
Read More
When unit testing Application Controller Classes, for example, that depend on session state to run, you don't have access to session state while testing. This makes it difficult to unit test the class without introducing a session state wrapper that can be mocked during testing. The Web Client Software Factory offers such a wrapper, called StateValue<T>, that helps you with unit testing classes that rely on session state variables to function.
Read More
I have received a few requests for the Web.config settings used to ASP.NET AJAX-Enable the Web Client Software Factory that I mentioned here...
Read More
The Web Client Software Factory comes with a bit of plumbing pre-configured for you. Some of this can be exposed by using the Enterprise Library Configuration Tool to get a nice graphical representation of the Web.config file that is intially built by WCSF...
Read More
The Client Team at patterns & practices will be hosting Web Client Software Factory training for 2 days. This is an instructor-led training event covering the recently released Web Client Software Factory. I am talking FREE Web Developer Training direct from the team who built it.
Read More
I talked about the Web Client Software Factory and how it greatly assists you with implementing the Model-View-Presenter Pattern in your web applications by automatically generating your presenter and view interface classes as well as injecting their dependencies. Using the Model-View-Presenter Pattern in your web applications is definitely a proven practice and highly recommended, but there may will be cases when using it is not right for your application...
Read More
An example showing off the Web Client Software Factory and AJAX.
Read More
I have uploaded a sample Visual Studio Solution that shows how to use the Web Client Software Factory to insert, update, delete, and list Subscribers in a table.
Read More