Allowing Null Propagation for ?error.Foo.Bar
[castle.git] / MonoRail / TestSiteBrail / Controllers / HomeController.cs
blobd0e19120fb6216edb587c7914352070054269ddd
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.Views.Brail.TestSite.Controllers
17 using System.Collections;
18 using System.Reflection;
19 using Boo.Lang;
20 using Castle.DynamicProxy;
21 using Castle.MonoRail.Framework;
22 using System;
24 [Serializable]
25 public class HomeController : Controller
27 public void Bag()
29 this.PropertyBag.Add("CustomerName", "hammett");
30 string[] textArray1 = new string[] { "1", "2", "3" };
31 this.PropertyBag.Add("List", textArray1);
34 public void ComplexNestedExpressions()
36 PropertyBag["title"] = "first";
37 PropertyBag["pageIndex"] = 5;
40 public void ComplexNestedExpressions2()
42 PropertyBag["title"] = "first";
43 PropertyBag["pageIndex"] = 5;
46 public void Bag2()
48 this.PropertyBag.Add("CustomerName", "hammett");
49 string[] textArray1 = new string[] { "1", "2", "3" };
50 this.PropertyBag.Add("List", textArray1);
53 public void Empty()
57 public void HelloFromCommon()
61 public void Index()
65 public void WithNothingAfterTheLastSeperator()
70 public void WithDynamicProxyObject()
72 ProxyGenerator generator = new ProxyGenerator();
73 object o = generator.CreateClassProxy(typeof(SimpleProxy),new StandardInterceptor());
74 try
76 o.GetType().GetProperty("Text");
77 throw new InvalidOperationException("Should have gotten AmbiguousMatchException here");
79 catch
82 PropertyBag["src"] = o;
85 public class SimpleProxy
87 public virtual string Text
89 get { return "BarBaz"; }
90 set { }
94 public void NullableProperties()
96 Foo[] fooArray1 = new Foo[] { new Foo("Bar"), new Foo(null), new Foo("Baz") };
97 this.PropertyBag.Add("List", fooArray1);
100 public void Nullables()
102 this.PropertyBag.Add("doesExists", "foo");
105 public void PreProcessor()
107 this.PropertyBag.Add("Title", "Ayende");
110 public void RedirectAction()
112 this.Redirect("home", "index");
115 public void RedirectForOtherArea()
117 this.Redirect("subrea", "home", "index");
120 public void ShowEmptyList()
122 this.PropertyBag.Add("dic", new Hash());
123 this.RenderView("ShowList");
126 public void ShowList()
128 Hashtable values = new Hashtable();
129 values.Add("Ayende", "Rahien");
130 values.Add("Foo", "Bar");
131 this.PropertyBag.Add("dic", values);
134 public void Welcome()
136 this.RenderView("heyhello");
139 public void Repeater()
144 public void NamespacesInConfig()
149 public void SubView()
154 public void Javascript()
159 public void Javascript2()
164 public void UsingQuotes()
169 public void DuckOverloadToString()
171 PropertyBag["birthday"] = new DateTime(1981, 12, 20);
174 public void NullPropagation()