SPRNET-843 - second attempt at solution templates, now conforming to project layout expected by Solution Factory add-in!
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<%@ Page Language="C#" EnableViewState="false" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="DI_HelloWorld_Default" %>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<head runat="server">
|
||||
<title><%=Title%></title>
|
||||
</head>
|
||||
<body>
|
||||
<h2><a href="../../Default.aspx">Welcome to Spring.NET Web Framework Quick Start Application Template</a></h2>
|
||||
<h2><a href="../Default.aspx">Dependency Injection</a></h2>
|
||||
<div>
|
||||
<h2>Hello World example</h2>
|
||||
<form id="form1" runat="server">
|
||||
<p>
|
||||
This very simple web form demonstrates dependency injection on pages and controls.
|
||||
</p>
|
||||
<p>
|
||||
The message you can see below has been injected by <object type="Default.aspx"> object definition:
|
||||
</p>
|
||||
<p>
|
||||
'<%=Message%>'
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Web.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Notice that you don't need to extend Spring.Web.UI.Page for DI features!
|
||||
/// </summary>
|
||||
public partial class DI_HelloWorld_Default : System.Web.UI.Page
|
||||
{
|
||||
private string message;
|
||||
|
||||
public string Message
|
||||
{
|
||||
get { return this.message; }
|
||||
set { this.message = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Values are injected right before OnInit() is called.
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
if(this.Message == null)
|
||||
{
|
||||
throw new ArgumentNullException("Message");
|
||||
}
|
||||
|
||||
base.OnInit(e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<spring>
|
||||
<context>
|
||||
<resource uri="config://spring/objects"/>
|
||||
</context>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
|
||||
<!-- use the filename of your Page for the 'type' attribute to configure DI for a Page -->
|
||||
<object type="Default.aspx">
|
||||
<property name="Title" value="Dependency Injection - Hello World Sample"/>
|
||||
<property name="Message">
|
||||
<value>This message you are reading was set using dependencies injection.</value>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
</spring>
|
||||
<system.web>
|
||||
|
||||
</system.web>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user