1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
20 using Castle
.MonoRail
.Framework
.Internal
;
23 /// Represents a view source embedded as an assembly resource.
25 public class EmbeddedResourceViewSource
: IViewSource
27 private readonly AssemblySourceInfo sourceInfo
;
28 private readonly string templateName
;
31 /// Initializes a new instance of the <see cref="EmbeddedResourceViewSource"/> class.
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
;
42 /// Opens the view stream.
44 /// <returns></returns>
45 public Stream
OpenViewStream()
47 return sourceInfo
.GetTemplateStream(templateName
);
51 /// Gets the last modified.
53 /// <value>The last modified.</value>
54 public long LastModified
56 get { return DateTime.MinValue.Ticks; }
60 /// Gets or sets the last updated.
62 /// <value>The last updated.</value>
63 public long LastUpdated
65 get { return DateTime.MinValue.Ticks; }
70 /// Gets a value indicating whether cache is enabled for it.
72 /// <value><c>true</c> if cache is enabled for it; otherwise, <c>false</c>.</value>
73 public bool EnableCache