Add Caching quick start [SPRNET-1447]
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.CachingQuickStart.Web", "src\Spring.CachingQuickStart.Web\Spring.CachingQuickStart.Web.2008.csproj", "{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.CachingQuickStart.Web.2010", "src\Spring.CachingQuickStart.Web\Spring.CachingQuickStart.Web.2010.csproj", "{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,111 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Spring.CachingQuickStart.Web._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>
|
||||
<title>Caching QuickStart</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<h2>
|
||||
Using Cache Aspect:
|
||||
</h2>
|
||||
<p>
|
||||
<asp:TextBox ID="GetByIdTextBox" runat="server"></asp:TextBox>
|
||||
<br />
|
||||
<asp:Button ID="GetByIdButton" runat="server" Text="GetById" OnClick="GetByIdButton_Click" />
|
||||
<br />
|
||||
<asp:Label ID="GetByIdLabel" runat="server" Text=""></asp:Label>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
<asp:Button ID="FindAllButton" runat="server" Text="FindAll" OnClick="FindAllButton_Click" />
|
||||
<br />
|
||||
<asp:Repeater ID="FindAllRepeater" runat="server">
|
||||
<HeaderTemplate>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<tr>
|
||||
<th>
|
||||
ID
|
||||
</th>
|
||||
<th>
|
||||
TITLE
|
||||
</th>
|
||||
</tr>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<tr>
|
||||
<td>
|
||||
<%# Eval("ID") %>
|
||||
</td>
|
||||
<td>
|
||||
<%# Eval("Title") %>
|
||||
</td>
|
||||
</tr>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
</table>
|
||||
</FooterTemplate>
|
||||
</asp:Repeater>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
ID: <asp:TextBox ID="SaveIdTextBox" runat="server"></asp:TextBox>
|
||||
<br />
|
||||
Title: <asp:TextBox ID="SaveTitleTextBox" runat="server"></asp:TextBox>
|
||||
<br />
|
||||
<asp:Button ID="SaveButton" runat="server" Text="Save"
|
||||
onclick="SaveButton_Click" />
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
<asp:TextBox ID="DeleteIdTextBox" runat="server"></asp:TextBox>
|
||||
<br />
|
||||
<asp:Button ID="DeleteButton" runat="server" Text="Delete"
|
||||
onclick="DeleteButton_Click" />
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
</p>
|
||||
<h2>
|
||||
Using Caching API (ICache interface) programmatically to show cache content:
|
||||
</h2>
|
||||
<p>
|
||||
<asp:Repeater ID="CacheRepeater" runat="server">
|
||||
<HeaderTemplate>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<tr>
|
||||
<th>
|
||||
KEY
|
||||
</th>
|
||||
<th>
|
||||
VALUE
|
||||
</th>
|
||||
</tr>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<tr>
|
||||
<td>
|
||||
<%# Eval("Key") %>
|
||||
</td>
|
||||
<td>
|
||||
<%# Eval("Value") %>
|
||||
</td>
|
||||
</tr>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
</table>
|
||||
</FooterTemplate>
|
||||
</asp:Repeater>
|
||||
<br />
|
||||
<asp:Button ID="ClearButton" runat="server" Text="Clear"
|
||||
onclick="ClearButton_Click" />
|
||||
<asp:Button ID="RefreshButton" runat="server" Text="Refresh"
|
||||
onclick="RefreshButton_Click" />
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Caching;
|
||||
|
||||
using Spring.CachingQuickStart.Services;
|
||||
|
||||
namespace Spring.CachingQuickStart.Web
|
||||
{
|
||||
public partial class _Default : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// GetById
|
||||
protected void GetByIdButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
IMovieService movieService = ctx.GetObject("MovieService") as IMovieService;
|
||||
|
||||
Movie movie = movieService.GetById(Int32.Parse(this.GetByIdTextBox.Text));
|
||||
|
||||
this.GetByIdLabel.Text = movie.Title;
|
||||
|
||||
UpdateCacheContent();
|
||||
}
|
||||
|
||||
// FindAll
|
||||
protected void FindAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
IMovieService movieService = ctx.GetObject("MovieService") as IMovieService;
|
||||
|
||||
IEnumerable<Movie> movies = movieService.FindAll();
|
||||
|
||||
this.FindAllRepeater.DataSource = movies;
|
||||
this.FindAllRepeater.DataBind();
|
||||
|
||||
UpdateCacheContent();
|
||||
}
|
||||
|
||||
// Save
|
||||
protected void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
IMovieService movieService = ctx.GetObject("MovieService") as IMovieService;
|
||||
|
||||
Movie movie = new Movie(
|
||||
Int32.Parse(this.SaveIdTextBox.Text),
|
||||
this.SaveTitleTextBox.Text);
|
||||
|
||||
movieService.Save(movie);
|
||||
|
||||
UpdateCacheContent();
|
||||
}
|
||||
|
||||
// Delete
|
||||
protected void DeleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
IMovieService movieService = ctx.GetObject("MovieService") as IMovieService;
|
||||
|
||||
Movie movie = new Movie(
|
||||
Int32.Parse(this.DeleteIdTextBox.Text),
|
||||
"NotUsed");
|
||||
|
||||
movieService.Delete(movie);
|
||||
|
||||
UpdateCacheContent();
|
||||
}
|
||||
|
||||
|
||||
// Using Caching API programmatically
|
||||
|
||||
protected void ClearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearCacheContent();
|
||||
UpdateCacheContent();
|
||||
}
|
||||
|
||||
protected void RefreshButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateCacheContent();
|
||||
}
|
||||
|
||||
private void ClearCacheContent()
|
||||
{
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
ICache cache = ctx.GetObject("DefaultCache") as ICache;
|
||||
|
||||
cache.Clear();
|
||||
}
|
||||
|
||||
private void UpdateCacheContent()
|
||||
{
|
||||
IList<CacheEntry> cacheEntries = new List<CacheEntry>();
|
||||
|
||||
IApplicationContext ctx = ContextRegistry.GetContext();
|
||||
ICache cache = ctx.GetObject("DefaultCache") as ICache;
|
||||
|
||||
foreach (object key in cache.Keys)
|
||||
{
|
||||
cacheEntries.Add(new CacheEntry() { Key = key, Value = cache.Get(key) });
|
||||
}
|
||||
|
||||
this.CacheRepeater.DataSource = cacheEntries;
|
||||
this.CacheRepeater.DataBind();
|
||||
}
|
||||
|
||||
public class CacheEntry
|
||||
{
|
||||
public object Key { get; set; }
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
141
examples/Spring/Spring.CachingQuickStart/src/Spring.CachingQuickStart.Web/Default.aspx.designer.cs
generated
Normal file
141
examples/Spring/Spring.CachingQuickStart/src/Spring.CachingQuickStart.Web/Default.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,141 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Spring.CachingQuickStart.Web {
|
||||
|
||||
|
||||
public partial class _Default {
|
||||
|
||||
/// <summary>
|
||||
/// form1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// GetByIdTextBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox GetByIdTextBox;
|
||||
|
||||
/// <summary>
|
||||
/// GetByIdButton control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button GetByIdButton;
|
||||
|
||||
/// <summary>
|
||||
/// GetByIdLabel control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label GetByIdLabel;
|
||||
|
||||
/// <summary>
|
||||
/// FindAllButton control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button FindAllButton;
|
||||
|
||||
/// <summary>
|
||||
/// FindAllRepeater control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Repeater FindAllRepeater;
|
||||
|
||||
/// <summary>
|
||||
/// SaveIdTextBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox SaveIdTextBox;
|
||||
|
||||
/// <summary>
|
||||
/// SaveTitleTextBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox SaveTitleTextBox;
|
||||
|
||||
/// <summary>
|
||||
/// SaveButton control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button SaveButton;
|
||||
|
||||
/// <summary>
|
||||
/// DeleteIdTextBox control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox DeleteIdTextBox;
|
||||
|
||||
/// <summary>
|
||||
/// DeleteButton control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button DeleteButton;
|
||||
|
||||
/// <summary>
|
||||
/// CacheRepeater control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Repeater CacheRepeater;
|
||||
|
||||
/// <summary>
|
||||
/// ClearButton control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button ClearButton;
|
||||
|
||||
/// <summary>
|
||||
/// RefreshButton control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button RefreshButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Spring.CachingQuickStart.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the interface for manipulating movies independent of <i>how</i>
|
||||
/// said movies are actually stored (text file, database, etc).
|
||||
/// </summary>
|
||||
public interface IMovieService
|
||||
{
|
||||
Movie GetById(int id);
|
||||
|
||||
IEnumerable<Movie> FindAll();
|
||||
|
||||
void Save(Movie movie);
|
||||
|
||||
void Delete(Movie movie);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Spring.CachingQuickStart.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// An object that describes a movie.
|
||||
/// </summary>
|
||||
public class Movie
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the
|
||||
/// <see cref="Spring.CachingQuickStart.Services.Movie"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the movie.</param>
|
||||
/// <param name="title">The title of the movie.</param>
|
||||
public Movie(int id, string title)
|
||||
{
|
||||
this.ID = id;
|
||||
this.Title = title;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format(
|
||||
"Movie[ID='{0}'; Title='{1}']",
|
||||
this.ID, this.Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Spring.Caching;
|
||||
|
||||
namespace Spring.CachingQuickStart.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic implementation of the IMovieService interface.
|
||||
/// </summary>
|
||||
public class MovieService : IMovieService
|
||||
{
|
||||
private IDictionary<int, Movie> movies;
|
||||
|
||||
public MovieService()
|
||||
{
|
||||
this.movies = new Dictionary<int, Movie>();
|
||||
this.movies.Add(1, new Movie(1, "La vita e bella"));
|
||||
this.movies.Add(2, new Movie(2, "Blue Velvet"));
|
||||
}
|
||||
|
||||
[CacheResult("DefaultCache", "'Movie-' + #id")]
|
||||
public Movie GetById(int id)
|
||||
{
|
||||
if (this.movies.ContainsKey(id))
|
||||
{
|
||||
return this.movies[id];
|
||||
}
|
||||
throw new ApplicationException(String.Format("Movie (ID='{0}') does not exist.", id));
|
||||
}
|
||||
|
||||
[CacheResult("DefaultCache", "'AllMovies'", TimeToLive = "2m")]
|
||||
[CacheResultItems("DefaultCache", "'Movie-' + ID")]
|
||||
public IEnumerable<Movie> FindAll()
|
||||
{
|
||||
return movies.Values;
|
||||
}
|
||||
|
||||
[InvalidateCache("DefaultCache", Keys = "'AllMovies'")]
|
||||
public void Save(
|
||||
[CacheParameter("DefaultCache", "'Movie-' + ID")]Movie movie)
|
||||
{
|
||||
if (this.movies.ContainsKey(movie.ID))
|
||||
{
|
||||
this.movies[movie.ID] = movie;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.movies.Add(movie.ID, movie);
|
||||
}
|
||||
}
|
||||
|
||||
[InvalidateCache("DefaultCache", Keys = "'Movie-' + #movie.ID")]
|
||||
[InvalidateCache("DefaultCache", Keys = "'AllMovies'")]
|
||||
public void Delete(Movie movie)
|
||||
{
|
||||
if (this.movies.ContainsKey(movie.ID))
|
||||
{
|
||||
this.movies.Remove(movie.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.CachingQuickStart</RootNamespace>
|
||||
<AssemblyName>Spring.CachingQuickStart.Web</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Spring.Aop, Version=1.3.1.20711, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spring.Core, Version=1.3.1.20711, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spring.Web, Version=1.3.1.20711, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Default.aspx" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Default.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Default.aspx.designer.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\IMovieService.cs" />
|
||||
<Compile Include="Services\Movie.cs" />
|
||||
<Compile Include="Services\MovieService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Spring.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>54312</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F02A190A-C98A-434B-8203-D9E5EBCDE9DB}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.CachingQuickStart</RootNamespace>
|
||||
<AssemblyName>Spring.CachingQuickStart.Web</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkProfile />
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Spring.Aop, Version=0.0.0.20709, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Aop.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spring.Core, Version=0.0.0.20709, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spring.Web, Version=0.0.0.20709, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Default.aspx" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Default.aspx.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Default.aspx.designer.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\IMovieService.cs" />
|
||||
<Compile Include="Services\Movie.cs" />
|
||||
<Compile Include="Services\MovieService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Spring.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>31290</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
|
||||
<!-- IMovieService definition -->
|
||||
<object id="MovieService" type="Spring.CachingQuickStart.Services.MovieService, Spring.CachingQuickStart.Web" />
|
||||
|
||||
|
||||
<!-- ASP.NET Cache definition -->
|
||||
<object id="DefaultCache" type="Spring.Caching.AspNetCache, Spring.Web">
|
||||
<property name="Priority" value="Normal" />
|
||||
<property name="SlidingExpiration" value="false" />
|
||||
<property name="TimeToLive" value="30s" />
|
||||
</object>
|
||||
|
||||
|
||||
<!-- Cache aspect definition -->
|
||||
|
||||
<object id="CacheAspect" type="Spring.Aspects.Cache.CacheAspect, Spring.Aop"/>
|
||||
|
||||
<object type="Spring.Aop.Framework.AutoProxy.TypeNameAutoProxyCreator, Spring.Aop">
|
||||
<property name="TypeNames">
|
||||
<list>
|
||||
<value>Spring.CachingQuickStart.Services.*</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="InterceptorNames">
|
||||
<list>
|
||||
<value>CacheAspect</value>
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
|
||||
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<spring>
|
||||
<context>
|
||||
<resource uri="web://~/Spring.config"/>
|
||||
</context>
|
||||
</spring>
|
||||
<appSettings/>
|
||||
<connectionStrings/>
|
||||
<system.web>
|
||||
<httpModules>
|
||||
<add name="SpringModule" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
|
||||
</httpModules>
|
||||
<!--
|
||||
Définissez compilation debug="true" pour insérer des symboles
|
||||
de débogage dans la page compilée. Comme ceci
|
||||
affecte les performances, définissez cette valeur à true uniquement
|
||||
lors du développement.
|
||||
-->
|
||||
<compilation debug="true"/>
|
||||
<!--
|
||||
La section <authentication> permet la configuration
|
||||
du mode d'authentification de sécurité utilisé par
|
||||
ASP.NET pour identifier un utilisateur entrant.
|
||||
-->
|
||||
<authentication mode="Windows"/>
|
||||
<!--
|
||||
La section <customErrors> permet de configurer
|
||||
les actions à exécuter si/quand une erreur non gérée se produit
|
||||
lors de l'exécution d'une demande. Plus précisément,
|
||||
elle permet aux développeurs de configurer les pages d'erreur html
|
||||
pour qu'elles s'affichent à la place d'une trace de la pile d'erreur.
|
||||
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||
<error statusCode="403" redirect="NoAccess.htm" />
|
||||
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||
</customErrors>
|
||||
-->
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -168,6 +168,7 @@ Documented sample applications can be found in "examples":
|
||||
* IoCQuickStart.AppContext - Show use of various IApplicationContext features.
|
||||
* IoCQuickStart.EventRegistry - Show use of loosely coupled eventing features.
|
||||
* AopQuickStart - Show use of AOP features.
|
||||
* CachingQuickStart - Show use of Caching abstraction.
|
||||
* SpringAir - Show use of Spring.Web features.
|
||||
* Calculator - Show use of Spring.Services features.
|
||||
* WebQuickStart - Show step by step usage of Spring.Web features.
|
||||
@@ -177,7 +178,7 @@ Documented sample applications can be found in "examples":
|
||||
* Data.NHibernate.Northwind - Show use of Spring's NHibernate features.
|
||||
* WCFQuickStart - Show use of DI and AOP with WCF
|
||||
* NMSQuickStart - Sample application using NMS
|
||||
* MSMQ QuickStart - Sample applicaiton usingMSMQ
|
||||
* MSMQ QuickStart - Sample application using MSMQ
|
||||
* Quartz Example - Scheduling using Quartz
|
||||
|
||||
7. How to build
|
||||
|
||||
Reference in New Issue
Block a user