Changeset 257

Show
Ignore:
Timestamp:
11/30/08 18:59:56 (1 month ago)
Author:
louis.dejardin
Message:

Applied patch from Pete Mounce
Closes #90 Configurable Null exception behaviour

Default is Lenient, which will not interrupt page output. Strict will throw ArgumentNullException? whose message contains the throwing ${expression}. Usage:

<spark>

<compilation nullBehaviour="Lenient|Strict"/>

</spark>

or

SparkSettings? settings;
settings.SetNullBehaviour?(NullBehaviour?.Lenient | NullBehaviour?.Strict);

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/spark.build

    r246 r257  
    124124                                </categories> 
    125125                        </test> 
     126                        <test assemblyname="${build.dir}/Spark.Ruby.Tests.dll"> 
     127                                <categories> 
     128                                        <exclude name="Integration" /> 
     129                                </categories> 
     130                        </test> 
     131                        <test assemblyname="${build.dir}/Spark.Python.Tests.dll"> 
     132                                <categories> 
     133                                        <exclude name="Integration" /> 
     134                                </categories> 
     135                        </test> 
     136                        <test assemblyname="${build.dir}/Spark.Web.Mvc.Ruby.Tests.dll"> 
     137                                <categories> 
     138                                        <exclude name="Integration" /> 
     139                                </categories> 
     140                        </test> 
    126141                </nunit2> 
    127142        </target> 
  • trunk/src/Castle.MonoRail.Views.Spark.Tests/Castle.MonoRail.Views.Spark.Tests.csproj

    r217 r257  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
    6     <ProductVersion>9.0.21022</ProductVersion> 
     6    <ProductVersion>9.0.30729</ProductVersion> 
    77    <SchemaVersion>2.0</SchemaVersion> 
    88    <ProjectGuid>{AD93C831-E12E-45AE-B654-682F9EFAE314}</ProjectGuid> 
     
    7878    <Compile Include="Helpers\HomeController.cs" /> 
    7979    <Compile Include="ModelDictionaryTests.cs" /> 
     80    <Compile Include="Models\UserInfo.cs" /> 
    8081    <Compile Include="PrecompileInstallerTests.cs" /> 
    8182    <Compile Include="Properties\AssemblyInfo.cs" /> 
    8283    <Compile Include="SparkBatchCompilerTester.cs" /> 
    8384    <Compile Include="SparkViewDataTests.cs" /> 
     85    <Compile Include="SparkViewFactoryStrictNullBehaviourTests.cs" /> 
    8486    <Compile Include="SparkViewFactoryTests.cs" /> 
     87    <Compile Include="SparkViewFactoryTestsBase.cs" /> 
    8588    <Compile Include="Stubs\StubController.cs" /> 
    8689    <Compile Include="ViewComponents\AllFrameworkComponentTests.cs" /> 
     
    178181      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    179182    </None> 
     183    <None Include="MonoRail.Tests.Views\Home\NullBehaviourConfiguredToStrict_RegularConstruct.spark"> 
     184      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
     185    </None> 
     186    <None Include="MonoRail.Tests.Views\Home\NullBehaviourConfiguredToStrict_SuppressNullsConstruct.spark"> 
     187      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
     188    </None> 
    180189    <None Include="MonoRail.Tests.Views\Home\ComponentBodySimpleHtml.spark"> 
    181190      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
     
    218227    </None> 
    219228    <None Include="MonoRail.Tests.Views\Home\ComponentRenderViewUsesGlobalSpark.spark"> 
     229      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
     230    </None> 
     231    <None Include="MonoRail.Tests.Views\Home\NullBehaviourConfiguredToLenient.spark"> 
    220232      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    221233    </None> 
  • trunk/src/Castle.MonoRail.Views.Spark.Tests/ModelDictionaryTests.cs

    r213 r257  
    1 using System; 
    2 using System.Collections.Generic; 
    3 using System.Linq; 
    4 using System.Text; 
    5 using NUnit.Framework; 
     1// Copyright 2008 Louis DeJardin - http://whereslou.com 
     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. 
     14//  
    615 
    716namespace Castle.MonoRail.Views.Spark.Tests 
    817{ 
     18    using System.Collections.Generic; 
     19    using NUnit.Framework; 
     20 
    921    [TestFixture] 
    1022    public class ModelDictionaryTests 
  • trunk/src/Castle.MonoRail.Views.Spark.Tests/PrecompileInstallerTests.cs

    r187 r257  
    1313// limitations under the License. 
    1414//  
    15 using System; 
    16 using System.Collections; 
    17 using System.Collections.Generic; 
    18 using System.Configuration.Install; 
    19 using System.IO; 
    20 using System.Linq; 
    21 using System.Reflection; 
    22 using System.Text; 
    23 using Castle.MonoRail.Views.Spark.Install; 
    24 using Castle.MonoRail.Views.Spark.Tests.Stubs; 
    25 using NUnit.Framework; 
    2615 
    2716namespace Castle.MonoRail.Views.Spark.Tests 
    2817{ 
     18    using System; 
     19    using System.Collections; 
     20    using System.Configuration.Install; 
     21    using System.IO; 
     22    using System.Linq; 
     23    using System.Reflection; 
     24    using Castle.MonoRail.Views.Spark.Install; 
     25    using Castle.MonoRail.Views.Spark.Tests.Stubs; 
     26    using NUnit.Framework; 
     27 
    2928    [TestFixture] 
    3029    public class PrecompileInstallerTests 
  • trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkBatchCompilerTester.cs

    r187 r257  
    1313// limitations under the License. 
    1414//  
    15 using Castle.MonoRail.Framework; 
    16 using Castle.MonoRail.Framework.Helpers; 
    17 using Castle.MonoRail.Framework.Test; 
    18 using Castle.MonoRail.Views.Spark; 
    19 using Castle.MonoRail.Views.Spark.Tests.Stubs; 
    20 using NUnit.Framework; 
    21 using Spark; 
    22 using System.Linq; 
    23 using Spark.FileSystem; 
    2415 
    2516namespace Castle.MonoRail.Views.Spark.Tests 
    2617{ 
     18    using System.Linq; 
     19    using NUnit.Framework; 
     20 
     21    using Castle.MonoRail.Framework; 
     22    using Castle.MonoRail.Framework.Helpers; 
     23    using Castle.MonoRail.Framework.Test; 
     24    using Castle.MonoRail.Views.Spark.Tests.Stubs; 
     25 
     26    using global::Spark; 
     27    using global::Spark.FileSystem; 
     28 
    2729    [TestFixture] 
    2830    public class SparkBatchCompilerTester 
  • trunk/src/Castle.MonoRail.Views.Spark.Tests/SparkViewFactoryTests.cs

    r229 r257  
    1313// limitations under the License. 
    1414//  
    15 using Castle.MonoRail.Framework.Providers; 
    16  
    1715namespace Castle.MonoRail.Views.Spark.Tests 
    1816{ 
    19     using System; 
    20     using System.Collections; 
    21     using System.Collections.Generic; 
    22     using System.Collections.Specialized; 
    2317    using System.IO; 
    2418 
    25     using Castle.Core.Logging; 
     19 
    2620    using Castle.MonoRail.Framework; 
    2721    using Castle.MonoRail.Framework.Helpers; 
    28     using Castle.MonoRail.Framework.Routing; 
    2922    using Castle.MonoRail.Framework.Services; 
    30     using Castle.MonoRail.Framework.Test; 
    31  
    3223    using NUnit.Framework; 
    33     using Rhino.Mocks; 
    3424    using global::Spark; 
    3525 
     26 
    3627    [TestFixture] 
    37     public class SparkViewFactoryTests 
    38    
    39         private MockRepository mocks; 
    40         private IEngineContext engineContext; 
    41         private IResponse response
    42         private IServerUtility server
     28    public class SparkViewFactoryTests : SparkViewFactoryTestsBase 
     29       
     30                protected override void Configure() 
     31                { 
     32                       factory = new SparkViewFactory()
     33                       factory.Service(serviceProvider)
    4334 
    44         private IController controller; 
    45         private IControllerContext controllerContext; 
     35                        manager = new DefaultViewEngineManager(); 
     36                        manager.Service(serviceProvider); 
     37                        serviceProvider.ViewEngineManager = manager; 
     38                        serviceProvider.AddService(typeof(IViewEngineManager), manager); 
    4639 
    47         private IDictionary propertyBag; 
     40                        manager.RegisterEngineForExtesionLookup(factory); 
     41                        manager.RegisterEngineForView(factory); 
     42                } 
    4843 
    49         private StringWriter output; 
    50         private DefaultViewEngineManager manager; 
    51         private IRoutingEngine routingEngine; 
    52         private SparkViewFactory factory; 
    53         private StubMonoRailServices serviceProvider; 
    54  
    55         [SetUp] 
    56         public void Init() 
    57         { 
    58             mocks = new MockRepository(); 
    59             serviceProvider = new StubMonoRailServices(); 
    60  
    61             var viewSourceLoader = new FileAssemblyViewSourceLoader("MonoRail.Tests.Views"); 
    62             viewSourceLoader.Service(this.serviceProvider); 
    63             serviceProvider.ViewSourceLoader = viewSourceLoader; 
    64             serviceProvider.AddService(typeof(IViewSourceLoader), viewSourceLoader); 
    65              
    66             factory = new SparkViewFactory(); 
    67             factory.Service(serviceProvider); 
    68  
    69             manager = new DefaultViewEngineManager(); 
    70             manager.Service(serviceProvider); 
    71             serviceProvider.ViewEngineManager = manager; 
    72             serviceProvider.AddService(typeof(IViewEngineManager), manager); 
    73  
    74             manager.RegisterEngineForExtesionLookup(factory); 
    75             manager.RegisterEngineForView(factory); 
    76  
    77  
    78             controllerContext = new ControllerContext(); 
    79             propertyBag = controllerContext.PropertyBag; 
    80              
    81             controllerContext.LayoutNames = new []{"default"}; 
    82             output = new StringWriter(); 
    83  
    84             server = new StubServerUtility(); 
    85             routingEngine = mocks.CreateMock<IRoutingEngine>(); 
    86             var urlBuilder = new DefaultUrlBuilder(server, routingEngine); 
    87             serviceProvider.UrlBuilder = urlBuilder; 
    88             serviceProvider.AddService(typeof(IUrlBuilder), urlBuilder); 
    89  
    90             InitUrlInfo("", "home", "index"); 
    91  
    92             response = engineContext.Response; 
    93         } 
    94  
    95  
    96         void InitUrlInfo(string areaName, string controllerName, string actionName) 
    97         { 
    98             var urlInfo = new UrlInfo(areaName, controllerName, actionName, "/", "castle"); 
    99  
    100             engineContext = new StubEngineContext(); 
    101             engineContext.AddService(typeof(IUrlBuilder), serviceProvider.UrlBuilder); 
    102             engineContext.CurrentController = controller; 
    103             engineContext.CurrentControllerContext = controllerContext; 
    104             engineContext.Services.ViewEngineManager = serviceProvider.ViewEngineManager; 
    105             output = (StringWriter) engineContext.Response.Output; 
    106  
    107             var routeMatch = new RouteMatch(); 
    108             controllerContext.RouteMatch = routeMatch; 
    109         } 
    110  
    111         static void ContainsInOrder(string content, params string[] values) 
    112         { 
    113             int index = 0; 
    114             foreach (string value in values) 
    115             { 
    116                 int nextIndex = content.IndexOf(value, index); 
    117                 Assert.GreaterOrEqual(nextIndex, 0, string.Format("Looking for {0}", value)); 
    118                 index = nextIndex + value.Length; 
    119             } 
    120         } 
    121  
    122         [Test] 
     44                [Test] 
    12345        public void ExtensionIsSpark() 
    12446        { 
     
    186108        } 
    187109 
     110                [Test] 
     111                public void NullBehaviourConfiguredToLenient() 
     112                { 
     113                        mocks.ReplayAll(); 
     114            manager.Process("Home\\NullBehaviourConfiguredToLenient", output, engineContext, controller, controllerContext); 
     115                        var content = output.ToString(); 
     116                        Assert.IsFalse(content.Contains("default")); 
     117 
     118                        ContainsInOrder(content, 
     119                                "<p>name kaboom *${user.Name}*</p>", 
     120                                "<p>name silently **</p>", 
     121                                "<p>name fixed *fred*</p>"); 
     122                } 
     123 
    188124        [Test] 
    189125        public void TerseHtmlEncode() 
  • trunk/src/CommonAssemblyInfo.cs

    r256 r257  
    66// <auto-generated> 
    77//     This code was generated by a tool. 
    8 //     Runtime Version:2.0.50727.1434 
     8//     Runtime Version:2.0.50727.3506 
    99// 
    1010//     Changes to this file may cause incorrect behavior and will be lost if 
  • trunk/src/Spark.Python

    • Property svn:ignore changed from
      bin
      obj
      to
      bin
      obj
      _ReSharper.TempSolution
  • trunk/src/Spark.Python/ScriptingLanguageFactory.cs

    r253 r257  
    5252            viewCompiler.Descriptor = descriptor; 
    5353            viewCompiler.Debug = engine.Settings.Debug; 
     54                viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; 
    5455            viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 
    5556            viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; 
  • trunk/src/Spark.Ruby/RubyLanguageFactory.cs

    r247 r257  
    5353            viewCompiler.Descriptor = descriptor; 
    5454            viewCompiler.Debug = engine.Settings.Debug; 
    55             viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 
     55                        viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; 
     56                        viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 
    5657            viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; 
    5758            return viewCompiler; 
  • trunk/src/Spark.Tests/App.config

    r89 r257  
    55  </configSections> 
    66  <spark> 
    7     <compilation debug="true"
     7    <compilation debug="true" nullBehaviour="Strict"
    88      <assemblies> 
    99        <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> 
  • trunk/src/Spark.Tests/SparkSectionHandlerTester.cs

    r187 r257  
    3939            var config = (SparkSectionHandler)ConfigurationManager.GetSection("spark"); 
    4040            Assert.IsTrue(config.Compilation.Debug); 
     41                Assert.AreEqual(NullBehaviour.Strict, config.Compilation.NullBehaviour); 
    4142            Assert.AreEqual(1, config.Compilation.Assemblies.Count); 
    4243            Assert.AreEqual(typeof(StubSparkView).FullName, config.Pages.PageBaseType); 
     
    6566            var settings = new SparkSettings() 
    6667                .SetDebug(true) 
     68                                .SetNullBehaviour(NullBehaviour.Lenient) 
    6769                .AddNamespace("System") 
    6870                .AddNamespace("System.Collections.Generic") 
     
    7274 
    7375            Assert.IsTrue(settings.Debug); 
     76                Assert.AreEqual(NullBehaviour.Lenient, settings.NullBehaviour); 
    7477            Assert.AreEqual(3, settings.UseNamespaces.Count()); 
    7578            Assert.AreEqual(2, settings.UseAssemblies.Count()); 
  • trunk/src/Spark.Tests/SparkViewFactoryTester.cs

    r256 r257  
    641641 
    642642        [Test] 
    643         public void     DynamicAttributes() 
     643        public void DynamicAttributes() 
    644644        { 
    645645            mocks.ReplayAll(); 
  • trunk/src/Spark/Compiler/CSharp/ChunkVisitors/GeneratedCodeVisitor.cs

    r256 r257  
    1313// limitations under the License. 
    1414//  
    15 using System.Collections; 
    1615using System.Collections.Generic; 
    17 using System.IO; 
    1816using System.Linq; 
    1917using System.Text; 
     
    2523    { 
    2624        private readonly StringBuilder _source; 
    27  
    28         public GeneratedCodeVisitor(StringBuilder output, Dictionary<string, object> globalSymbols) 
    29         { 
     25        private readonly NullBehaviour _nullBehaviour; 
     26 
     27        public GeneratedCodeVisitor(StringBuilder output, Dictionary<string, object> globalSymbols, NullBehaviour nullBehaviour) 
     28        { 
     29            _nullBehaviour = nullBehaviour; 
    3030            _source = output; 
    3131 
    32             _scope = new Scope(new Scope(null) {Variables = globalSymbols}); 
     32            _scope = new Scope(new Scope(null) { Variables = globalSymbols }); 
    3333        } 
    3434 
     
    6666                Prior = prior; 
    6767            } 
    68             public Dictionary<string,object> Variables { get; set; } 
     68            public Dictionary<string, object> Variables { get; set; } 
    6969            public Scope Prior { get; set; } 
    7070        } 
     
    8787        { 
    8888            var scan = _scope; 
    89             while(scan != null) 
     89            while (scan != null) 
    9090            { 
    9191                if (scan.Variables.ContainsKey(name)) 
     
    114114            CodeDefault(); 
    115115            AppendIndent().AppendLine("}"); 
    116             AppendIndent().AppendLine("catch(System.NullReferenceException)"); 
     116            AppendIndent().AppendLine("catch(System.NullReferenceException ex)"); 
    117117            AppendIndent().AppendLine("{"); 
    118             if (!chunk.SilentNulls) 
    119             { 
    120                 AppendIndent().Append("    Output.Write(\"${") 
     118            Indent += 4; 
     119            if (_nullBehaviour == NullBehaviour.Lenient) 
     120            { 
     121                if (!chunk.SilentNulls) 
     122                { 
     123                    AppendIndent().Append("Output.Write(\"${") 
     124                        .Append(EscapeStringContents(chunk.Code)) 
     125                        .AppendLine("}\");"); 
     126                } 
     127            } 
     128            else 
     129            { 
     130                AppendIndent().Append("throw new System.ArgumentNullException(\"${") 
    121131                    .Append(EscapeStringContents(chunk.Code)) 
    122                     .AppendLine("}\");"); 
    123             } 
     132                    .AppendLine("}\", ex);"); 
     133            } 
     134            Indent -= 4; 
    124135            AppendIndent().AppendLine("}"); 
    125136        } 
     
    299310        protected override void Visit(UseImportChunk chunk) 
    300311        { 
    301              
     312 
    302313        } 
    303314 
  • trunk/src/Spark/Compiler/CSharp/ChunkVisitors/GlobalMembersVisitor.cs

    r191 r257  
    2424        private readonly StringBuilder _source; 
    2525        private readonly Dictionary<string, object> _globalSymbols; 
    26         readonly Dictionary<string, string> _viewDataAdded = new Dictionary<string, string>(); 
     26        private readonly NullBehaviour _nullBehaviour; 
     27        readonly Dictionary<string, string> _viewDataAdded = new Dictionary<string, string>(); 
    2728        readonly Dictionary<string, GlobalVariableChunk> _globalAdded = new Dictionary<string, GlobalVariableChunk>(); 
    2829        private int _indent = 4; 
    2930 
    30         public GlobalMembersVisitor(StringBuilder output, Dictionary<string, object> globalSymbols
     31               public GlobalMembersVisitor(StringBuilder output, Dictionary<string, object> globalSymbols, NullBehaviour nullBehaviour
    3132        { 
    3233            _source = output; 
    3334            _globalSymbols = globalSymbols; 
     35                        _nullBehaviour = nullBehaviour; 
    3436        } 
    3537 
     
    171173 
    172174            CodeDefault(); 
    173             var generator = new GeneratedCodeVisitor(_source, null) { Indent = 12 }; 
     175            var generator = new GeneratedCodeVisitor(_source, null, _nullBehaviour) { Indent = 12 }; 
    174176            generator.Accept(chunk.Body); 
    175177 
  • trunk/src/Spark/Compiler/CSharp/DefaultViewCompiler.cs

    r225 r257  
    4040            var usingGenerator = new UsingNamespaceVisitor(source); 
    4141            var baseClassGenerator = new BaseClassVisitor { BaseClass = BaseClass }; 
    42             var globalsGenerator = new GlobalMembersVisitor(source, globalSymbols); 
     42            var globalsGenerator = new GlobalMembersVisitor(source, globalSymbols, NullBehaviour); 
    4343             
    4444 
     
    116116                source.AppendLine(string.Format("    public void RenderViewLevel{0}()", renderLevel)); 
    117117                source.AppendLine("    {"); 
    118                 var viewGenerator = new GeneratedCodeVisitor(source, globalSymbols) { Indent = 8 }; 
     118                var viewGenerator = new GeneratedCodeVisitor(source, globalSymbols, NullBehaviour) { Indent = 8 }; 
    119119                viewGenerator.Accept(viewTemplate); 
    120120                source.AppendLine("    }"); 
  • trunk/src/Spark/Compiler/ViewCompiler.cs

    r187 r257  
    3838 
    3939        public bool Debug { get; set; } 
    40         public IEnumerable<string> UseNamespaces { get; set; } 
     40                public NullBehaviour NullBehaviour { get; set; } 
     41        public IEnumerable<string> UseNamespaces { get; set; } 
    4142        public IEnumerable<string> UseAssemblies { get; set; } 
    4243 
  • trunk/src/Spark/Configuration/CompilationElement.cs

    r187 r257  
    1313// limitations under the License. 
    1414//  
     15using System; 
    1516using System.Configuration; 
    1617 
     
    2627        } 
    2728 
     29        [ConfigurationProperty("nullBehaviour", DefaultValue = NullBehaviour.Lenient)] 
     30        public NullBehaviour NullBehaviour 
     31        { 
     32            get { return (NullBehaviour)this["nullBehaviour"]; } 
     33            set { this["nullBehaviour"] = value; } 
     34        } 
     35 
    2836        [ConfigurationProperty("assemblies")] 
    2937        [ConfigurationCollection(typeof(AssemblyElementCollection))] 
  • trunk/src/Spark/Configuration/SparkSectionHandler.cs

    r187 r257  
    8484        } 
    8585 
     86        NullBehaviour ISparkSettings.NullBehaviour 
     87        { 
     88                        get { return Compilation.NullBehaviour; } 
     89        } 
     90 
    8691        string ISparkSettings.Prefix 
    8792        { 
  • trunk/src/Spark/DefaultLanguageFactory.cs

    r234 r257  
    3030            viewCompiler.Descriptor = descriptor; 
    3131            viewCompiler.Debug = engine.Settings.Debug; 
     32                viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; 
    3233            viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; 
    3334            viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; 
  • trunk/src/Spark/ISparkSettings.cs

    r187 r257  
    1919namespace Spark 
    2020{ 
     21        public enum NullBehaviour 
     22        { 
     23                /// <summary>Catch NullReferenceExceptions, and either render the literal expression, or render nothing, respectively, when ${expression} or $!{expression} syntax is used</summary> 
     24                /// <remarks><c>Lenient</c> is the default setting.</remarks> 
     25                Lenient, 
     26                /// <summary>Do not wrap expressions in try/catch blocks.  Intended for fail-fast in development environment.</summary> 
     27                Strict 
     28        } 
     29 
    2130    public interface ISparkSettings 
    2231    { 
    2332        bool Debug { get; } 
     33                NullBehaviour NullBehaviour { get; } 
    2434        string Prefix { get; } 
    2535        string PageBaseType { get; set; } 
     36 
    2637        IEnumerable<string> UseNamespaces { get; } 
    2738        IEnumerable<string> UseAssemblies { get; } 
  • trunk/src/Spark/SparkSettings.cs

    r187 r257  
    1515using System; 
    1616using System.Collections.Generic; 
    17 using System.Linq; 
    1817using System.Reflection; 
    19 using System.Text; 
    2018using Spark.FileSystem; 
    2119 
     
    3028            _resourceMappings = new List<ResourceMapping>(); 
    3129            _viewFolders = new List<IViewFolderSettings>(); 
     30                        NullBehaviour = NullBehaviour.Lenient; 
    3231        } 
    3332 
    3433        public bool Debug { get; set; } 
    35         public string Prefix { get; set; } 
     34                public NullBehaviour NullBehaviour { get; set; } 
     35        public string Prefix { get; set; } 
    3636        public string PageBaseType { get; set; } 
    3737 
     
    6565            return this; 
    6666        } 
     67 
     68                public SparkSettings SetNullBehaviour(NullBehaviour nullBehaviour) 
     69                { 
     70            NullBehaviour = nullBehaviour; 
     71                        return this; 
     72                } 
    6773 
    6874        public SparkSettings SetPageBaseType(string typeName)