- Fixed MR-84
[castle.git] / MonoRail / Castle.MonoRail.Framework / Views / EmbeddedResourceViewSource.cs
blob69251d4463e3e09e3818ee9759ff0d379c44187e
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework.Views
17 using System;
18 using System.IO;
20 using Castle.MonoRail.Framework.Internal;
22 /// <summary>
23 /// Represents a view source embedded as an assembly resource.
24 /// </summary>
25 public class EmbeddedResourceViewSource : IViewSource
27 private readonly AssemblySourceInfo sourceInfo;
28 private readonly string templateName;
30 /// <summary>
31 /// Initializes a new instance of the <see cref="EmbeddedResourceViewSource"/> class.
32 /// </summary>
33 /// <param name="templateName">Name of the template.</param>
34 /// <param name="sourceInfo">The source info.</param>
35 public EmbeddedResourceViewSource(String templateName, AssemblySourceInfo sourceInfo)
37 this.templateName = templateName;
38 this.sourceInfo = sourceInfo;
41 /// <summary>
42 /// Opens the view stream.
43 /// </summary>
44 /// <returns></returns>
45 public Stream OpenViewStream()
47 return sourceInfo.GetTemplateStream(templateName);
50 /// <summary>
51 /// Gets the last modified.
52 /// </summary>
53 /// <value>The last modified.</value>
54 public long LastModified
56 get { return DateTime.MinValue.Ticks; }
59 /// <summary>
60 /// Gets or sets the last updated.
61 /// </summary>
62 /// <value>The last updated.</value>
63 public long LastUpdated
65 get { return DateTime.MinValue.Ticks; }
66 set { ; }
69 /// <summary>
70 /// Gets a value indicating whether cache is enabled for it.
71 /// </summary>
72 /// <value><c>true</c> if cache is enabled for it; otherwise, <c>false</c>.</value>
73 public bool EnableCache
75 get { return true; }