11 changed files with 806 additions and 48 deletions
@ -0,0 +1,322 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.239
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ICSharpCode.AspNet.Mvc.AspxCSharp { |
||||||
|
using ICSharpCode.AspNet.Mvc; |
||||||
|
using System; |
||||||
|
|
||||||
|
|
||||||
|
public partial class Empty : EmptyBase { |
||||||
|
|
||||||
|
private global::Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost hostValue; |
||||||
|
|
||||||
|
|
||||||
|
#line 31 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
|
||||||
|
MvcTextTemplateHost MvcHost { |
||||||
|
get { return (MvcTextTemplateHost)Host; } |
||||||
|
} |
||||||
|
|
||||||
|
public string GetViewPageType() |
||||||
|
{ |
||||||
|
string viewDataTypeName = MvcHost.ViewDataTypeName; |
||||||
|
if (!String.IsNullOrEmpty(viewDataTypeName)) { |
||||||
|
return String.Format("<{0}>", viewDataTypeName); |
||||||
|
} |
||||||
|
return String.Empty; |
||||||
|
} |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
|
||||||
|
public global::Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost Host { |
||||||
|
get { |
||||||
|
return this.hostValue; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.hostValue = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public virtual string TransformText() { |
||||||
|
this.GenerationEnvironment = null; |
||||||
|
|
||||||
|
#line 3 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
if (MvcHost.IsPartialView) { |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 4 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("<%@ Control Language=\"C#\" Inherits=\"System.Web.Mvc.ViewUserControl\" %>\r\n\r\n"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 6 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
} else if(MvcHost.IsContentPage) { |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 7 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("<%@ Page Language=\"C#\" MasterPageFile=\""); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 7 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.MasterPageFile )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 7 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("\" Inherits=\"System.Web.Mvc.ViewPage"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 7 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( GetViewPageType() )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 7 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("\" %>\r\n\r\n<asp:Content ID=\"Content1\" ContentPlaceHolderID=\"Title\" runat=\"server\">\r\n" + |
||||||
|
""); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 10 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.ViewName )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 10 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("\r\n</asp:Content>\r\n\r\n<asp:Content ID=\"Content2\" ContentPlaceHolderID=\""); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 13 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.PrimaryContentPlaceHolderID )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 13 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("\" runat=\"server\">\r\n\t\r\n</asp:Content>\r\n"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 16 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
} else { |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 17 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("<%@ Page Language=\"C#\" Inherits=\"System.Web.Mvc.ViewPage"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 17 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( GetViewPageType() )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 17 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("\" %>\r\n\r\n<!DOCTYPE html>\r\n<html>\r\n\t<head runat=\"server\">\r\n\t\t<title>"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 22 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.ViewName )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 22 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
this.Write("</title>\r\n\t</head>\r\n\t<body>\r\n\t\t<div>\r\n\t\t\r\n\t\t</div>\r\n\t</body>\r\n</html>\r\n"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 30 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"
|
||||||
|
} |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
return this.GenerationEnvironment.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void Initialize() { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class EmptyBase { |
||||||
|
|
||||||
|
private global::System.Text.StringBuilder builder; |
||||||
|
|
||||||
|
private global::System.Collections.Generic.IDictionary<string, object> session; |
||||||
|
|
||||||
|
private global::System.CodeDom.Compiler.CompilerErrorCollection errors; |
||||||
|
|
||||||
|
private string currentIndent = string.Empty; |
||||||
|
|
||||||
|
private global::System.Collections.Generic.Stack<int> indents; |
||||||
|
|
||||||
|
private ToStringInstanceHelper _toStringHelper = new ToStringInstanceHelper(); |
||||||
|
|
||||||
|
public virtual global::System.Collections.Generic.IDictionary<string, object> Session { |
||||||
|
get { |
||||||
|
return this.session; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.session = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public global::System.Text.StringBuilder GenerationEnvironment { |
||||||
|
get { |
||||||
|
if ((this.builder == null)) { |
||||||
|
this.builder = new global::System.Text.StringBuilder(); |
||||||
|
} |
||||||
|
return this.builder; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.builder = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected global::System.CodeDom.Compiler.CompilerErrorCollection Errors { |
||||||
|
get { |
||||||
|
if ((this.errors == null)) { |
||||||
|
this.errors = new global::System.CodeDom.Compiler.CompilerErrorCollection(); |
||||||
|
} |
||||||
|
return this.errors; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string CurrentIndent { |
||||||
|
get { |
||||||
|
return this.currentIndent; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private global::System.Collections.Generic.Stack<int> Indents { |
||||||
|
get { |
||||||
|
if ((this.indents == null)) { |
||||||
|
this.indents = new global::System.Collections.Generic.Stack<int>(); |
||||||
|
} |
||||||
|
return this.indents; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ToStringInstanceHelper ToStringHelper { |
||||||
|
get { |
||||||
|
return this._toStringHelper; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Error(string message) { |
||||||
|
this.Errors.Add(new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message)); |
||||||
|
} |
||||||
|
|
||||||
|
public void Warning(string message) { |
||||||
|
global::System.CodeDom.Compiler.CompilerError val = new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message); |
||||||
|
val.IsWarning = true; |
||||||
|
this.Errors.Add(val); |
||||||
|
} |
||||||
|
|
||||||
|
public string PopIndent() { |
||||||
|
if ((this.Indents.Count == 0)) { |
||||||
|
return string.Empty; |
||||||
|
} |
||||||
|
int lastPos = (this.currentIndent.Length - this.Indents.Pop()); |
||||||
|
string last = this.currentIndent.Substring(lastPos); |
||||||
|
this.currentIndent = this.currentIndent.Substring(0, lastPos); |
||||||
|
return last; |
||||||
|
} |
||||||
|
|
||||||
|
public void PushIndent(string indent) { |
||||||
|
this.Indents.Push(indent.Length); |
||||||
|
this.currentIndent = (this.currentIndent + indent); |
||||||
|
} |
||||||
|
|
||||||
|
public void ClearIndent() { |
||||||
|
this.currentIndent = string.Empty; |
||||||
|
this.Indents.Clear(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Write(string textToAppend) { |
||||||
|
this.GenerationEnvironment.Append(textToAppend); |
||||||
|
} |
||||||
|
|
||||||
|
public void Write(string format, params object[] args) { |
||||||
|
this.GenerationEnvironment.AppendFormat(format, args); |
||||||
|
} |
||||||
|
|
||||||
|
public void WriteLine(string textToAppend) { |
||||||
|
this.GenerationEnvironment.Append(this.currentIndent); |
||||||
|
this.GenerationEnvironment.AppendLine(textToAppend); |
||||||
|
} |
||||||
|
|
||||||
|
public void WriteLine(string format, params object[] args) { |
||||||
|
this.GenerationEnvironment.Append(this.currentIndent); |
||||||
|
this.GenerationEnvironment.AppendFormat(format, args); |
||||||
|
this.GenerationEnvironment.AppendLine(); |
||||||
|
} |
||||||
|
|
||||||
|
public class ToStringInstanceHelper { |
||||||
|
|
||||||
|
private global::System.IFormatProvider formatProvider = global::System.Globalization.CultureInfo.InvariantCulture; |
||||||
|
|
||||||
|
public global::System.IFormatProvider FormatProvider { |
||||||
|
get { |
||||||
|
return this.formatProvider; |
||||||
|
} |
||||||
|
set { |
||||||
|
if ((this.formatProvider == null)) { |
||||||
|
throw new global::System.ArgumentNullException("formatProvider"); |
||||||
|
} |
||||||
|
this.formatProvider = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string ToStringWithCulture(object objectToConvert) { |
||||||
|
if ((objectToConvert == null)) { |
||||||
|
throw new global::System.ArgumentNullException("objectToConvert"); |
||||||
|
} |
||||||
|
global::System.Type type = objectToConvert.GetType(); |
||||||
|
global::System.Type iConvertibleType = typeof(global::System.IConvertible); |
||||||
|
if (iConvertibleType.IsAssignableFrom(type)) { |
||||||
|
return ((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider); |
||||||
|
} |
||||||
|
global::System.Reflection.MethodInfo methInfo = type.GetMethod("ToString", new global::System.Type[] { |
||||||
|
iConvertibleType}); |
||||||
|
if ((methInfo != null)) { |
||||||
|
return ((string)(methInfo.Invoke(objectToConvert, new object[] { |
||||||
|
this.formatProvider}))); |
||||||
|
} |
||||||
|
return objectToConvert.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,303 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.239
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ICSharpCode.AspNet.Mvc.CSHtml { |
||||||
|
using ICSharpCode.AspNet.Mvc; |
||||||
|
using System; |
||||||
|
|
||||||
|
|
||||||
|
public partial class Empty : EmptyBase { |
||||||
|
|
||||||
|
private global::Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost hostValue; |
||||||
|
|
||||||
|
|
||||||
|
#line 29 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
|
||||||
|
MvcTextTemplateHost MvcHost { |
||||||
|
get { return (MvcTextTemplateHost)Host; } |
||||||
|
} |
||||||
|
|
||||||
|
public string GetModelDirective() |
||||||
|
{ |
||||||
|
string viewDataTypeName = MvcHost.ViewDataTypeName; |
||||||
|
if (!String.IsNullOrEmpty(viewDataTypeName)) { |
||||||
|
return String.Format("@model {0}", viewDataTypeName); |
||||||
|
} |
||||||
|
return String.Empty; |
||||||
|
} |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
|
||||||
|
public global::Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost Host { |
||||||
|
get { |
||||||
|
return this.hostValue; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.hostValue = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public virtual string TransformText() { |
||||||
|
this.GenerationEnvironment = null; |
||||||
|
|
||||||
|
#line 4 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
if (MvcHost.IsPartialView) { |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 5 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("\r\n"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 6 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
} else if (MvcHost.IsContentPage) { |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 7 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("@{\r\n\tViewBag.Title = \""); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 8 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.ViewName )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 8 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("\";\r\n\tLayout = \""); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 9 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.MasterPageFile )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 9 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("\";\r\n}\r\n\r\n<h2>"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 12 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.ViewName )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 12 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("</h2>\r\n\r\n"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 14 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
} else { |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 15 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( GetModelDirective() )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 15 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("\r\n\r\n<!DOCTYPE html>\r\n<html>\r\n\t<head>\r\n\t\t<title>"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 20 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write(this.ToStringHelper.ToStringWithCulture( MvcHost.ViewName )); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 20 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
this.Write("</title>\r\n\t</head>\r\n\t<body>\r\n\t\t<div>\r\n\t\t\r\n\t\t</div>\r\n\t</body>\r\n</html>\r\n"); |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 28 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\CSHTML\Empty.tt"
|
||||||
|
} |
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
return this.GenerationEnvironment.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void Initialize() { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class EmptyBase { |
||||||
|
|
||||||
|
private global::System.Text.StringBuilder builder; |
||||||
|
|
||||||
|
private global::System.Collections.Generic.IDictionary<string, object> session; |
||||||
|
|
||||||
|
private global::System.CodeDom.Compiler.CompilerErrorCollection errors; |
||||||
|
|
||||||
|
private string currentIndent = string.Empty; |
||||||
|
|
||||||
|
private global::System.Collections.Generic.Stack<int> indents; |
||||||
|
|
||||||
|
private ToStringInstanceHelper _toStringHelper = new ToStringInstanceHelper(); |
||||||
|
|
||||||
|
public virtual global::System.Collections.Generic.IDictionary<string, object> Session { |
||||||
|
get { |
||||||
|
return this.session; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.session = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public global::System.Text.StringBuilder GenerationEnvironment { |
||||||
|
get { |
||||||
|
if ((this.builder == null)) { |
||||||
|
this.builder = new global::System.Text.StringBuilder(); |
||||||
|
} |
||||||
|
return this.builder; |
||||||
|
} |
||||||
|
set { |
||||||
|
this.builder = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected global::System.CodeDom.Compiler.CompilerErrorCollection Errors { |
||||||
|
get { |
||||||
|
if ((this.errors == null)) { |
||||||
|
this.errors = new global::System.CodeDom.Compiler.CompilerErrorCollection(); |
||||||
|
} |
||||||
|
return this.errors; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string CurrentIndent { |
||||||
|
get { |
||||||
|
return this.currentIndent; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private global::System.Collections.Generic.Stack<int> Indents { |
||||||
|
get { |
||||||
|
if ((this.indents == null)) { |
||||||
|
this.indents = new global::System.Collections.Generic.Stack<int>(); |
||||||
|
} |
||||||
|
return this.indents; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ToStringInstanceHelper ToStringHelper { |
||||||
|
get { |
||||||
|
return this._toStringHelper; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Error(string message) { |
||||||
|
this.Errors.Add(new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message)); |
||||||
|
} |
||||||
|
|
||||||
|
public void Warning(string message) { |
||||||
|
global::System.CodeDom.Compiler.CompilerError val = new global::System.CodeDom.Compiler.CompilerError(null, -1, -1, null, message); |
||||||
|
val.IsWarning = true; |
||||||
|
this.Errors.Add(val); |
||||||
|
} |
||||||
|
|
||||||
|
public string PopIndent() { |
||||||
|
if ((this.Indents.Count == 0)) { |
||||||
|
return string.Empty; |
||||||
|
} |
||||||
|
int lastPos = (this.currentIndent.Length - this.Indents.Pop()); |
||||||
|
string last = this.currentIndent.Substring(lastPos); |
||||||
|
this.currentIndent = this.currentIndent.Substring(0, lastPos); |
||||||
|
return last; |
||||||
|
} |
||||||
|
|
||||||
|
public void PushIndent(string indent) { |
||||||
|
this.Indents.Push(indent.Length); |
||||||
|
this.currentIndent = (this.currentIndent + indent); |
||||||
|
} |
||||||
|
|
||||||
|
public void ClearIndent() { |
||||||
|
this.currentIndent = string.Empty; |
||||||
|
this.Indents.Clear(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Write(string textToAppend) { |
||||||
|
this.GenerationEnvironment.Append(textToAppend); |
||||||
|
} |
||||||
|
|
||||||
|
public void Write(string format, params object[] args) { |
||||||
|
this.GenerationEnvironment.AppendFormat(format, args); |
||||||
|
} |
||||||
|
|
||||||
|
public void WriteLine(string textToAppend) { |
||||||
|
this.GenerationEnvironment.Append(this.currentIndent); |
||||||
|
this.GenerationEnvironment.AppendLine(textToAppend); |
||||||
|
} |
||||||
|
|
||||||
|
public void WriteLine(string format, params object[] args) { |
||||||
|
this.GenerationEnvironment.Append(this.currentIndent); |
||||||
|
this.GenerationEnvironment.AppendFormat(format, args); |
||||||
|
this.GenerationEnvironment.AppendLine(); |
||||||
|
} |
||||||
|
|
||||||
|
public class ToStringInstanceHelper { |
||||||
|
|
||||||
|
private global::System.IFormatProvider formatProvider = global::System.Globalization.CultureInfo.InvariantCulture; |
||||||
|
|
||||||
|
public global::System.IFormatProvider FormatProvider { |
||||||
|
get { |
||||||
|
return this.formatProvider; |
||||||
|
} |
||||||
|
set { |
||||||
|
if ((this.formatProvider == null)) { |
||||||
|
throw new global::System.ArgumentNullException("formatProvider"); |
||||||
|
} |
||||||
|
this.formatProvider = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string ToStringWithCulture(object objectToConvert) { |
||||||
|
if ((objectToConvert == null)) { |
||||||
|
throw new global::System.ArgumentNullException("objectToConvert"); |
||||||
|
} |
||||||
|
global::System.Type type = objectToConvert.GetType(); |
||||||
|
global::System.Type iConvertibleType = typeof(global::System.IConvertible); |
||||||
|
if (iConvertibleType.IsAssignableFrom(type)) { |
||||||
|
return ((global::System.IConvertible)(objectToConvert)).ToString(this.formatProvider); |
||||||
|
} |
||||||
|
global::System.Reflection.MethodInfo methInfo = type.GetMethod("ToString", new global::System.Type[] { |
||||||
|
iConvertibleType}); |
||||||
|
if ((methInfo != null)) { |
||||||
|
return ((string)(methInfo.Invoke(objectToConvert, new object[] { |
||||||
|
this.formatProvider}))); |
||||||
|
} |
||||||
|
return objectToConvert.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using AspNet.Mvc.Tests.Helpers; |
||||||
|
using ICSharpCode.AspNet.Mvc.AspxCSharp; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace AspNet.Mvc.Tests.CodeTemplates |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class AspxCSharpEmptyViewTemplateTests |
||||||
|
{ |
||||||
|
Empty emptyViewTemplate; |
||||||
|
TestableMvcTextTemplateHost mvcHost; |
||||||
|
|
||||||
|
void CreateEmptyViewTemplatePreprocessor() |
||||||
|
{ |
||||||
|
mvcHost = new TestableMvcTextTemplateHost(); |
||||||
|
emptyViewTemplate = new Empty(); |
||||||
|
emptyViewTemplate.Host = mvcHost; |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void GetViewPageType_HostViewDataTypeNameIsMyAppMyModel_ReturnsMyAppMyModelSurroundedByAngleBrackets() |
||||||
|
{ |
||||||
|
CreateEmptyViewTemplatePreprocessor(); |
||||||
|
mvcHost.ViewDataTypeName = "MyApp.MyModel"; |
||||||
|
|
||||||
|
string viewPageType = emptyViewTemplate.GetViewPageType(); |
||||||
|
|
||||||
|
Assert.AreEqual("<MyApp.MyModel>", viewPageType); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void GetViewPageType_HostViewDataTypeNameIsNull_ReturnsEmptyString() |
||||||
|
{ |
||||||
|
CreateEmptyViewTemplatePreprocessor(); |
||||||
|
mvcHost.ViewDataTypeName = null; |
||||||
|
|
||||||
|
string viewPageType = emptyViewTemplate.GetViewPageType(); |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, viewPageType); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void GetViewPageType_HostViewDataTypeNameIsEmptyString_ReturnsEmptyString() |
||||||
|
{ |
||||||
|
CreateEmptyViewTemplatePreprocessor(); |
||||||
|
mvcHost.ViewDataTypeName = String.Empty; |
||||||
|
|
||||||
|
string viewPageType = emptyViewTemplate.GetViewPageType(); |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, viewPageType); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,58 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using AspNet.Mvc.Tests.Helpers; |
||||||
|
using ICSharpCode.AspNet.Mvc.CSHtml; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace AspNet.Mvc.Tests.CodeTemplates |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class RazorCSharpEmptyViewTemplateTests |
||||||
|
{ |
||||||
|
Empty emptyViewTemplate; |
||||||
|
TestableMvcTextTemplateHost mvcHost; |
||||||
|
|
||||||
|
void CreateEmptyViewTemplatePreprocessor() |
||||||
|
{ |
||||||
|
mvcHost = new TestableMvcTextTemplateHost(); |
||||||
|
emptyViewTemplate = new Empty(); |
||||||
|
emptyViewTemplate.Host = mvcHost; |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void GetModelDirective_HostViewDataTypeNameIsMyAppMyModel_ReturnsRazorModelFollowedByMyAppMyModel() |
||||||
|
{ |
||||||
|
CreateEmptyViewTemplatePreprocessor(); |
||||||
|
mvcHost.ViewDataTypeName = "MyApp.MyModel"; |
||||||
|
|
||||||
|
string modelDirective = emptyViewTemplate.GetModelDirective(); |
||||||
|
|
||||||
|
Assert.AreEqual("@model MyApp.MyModel", modelDirective); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void GetModelDirective_HostViewDataTypeNameIsNull_ReturnsEmptyString() |
||||||
|
{ |
||||||
|
CreateEmptyViewTemplatePreprocessor(); |
||||||
|
mvcHost.ViewDataTypeName = null; |
||||||
|
|
||||||
|
string modelDirective = emptyViewTemplate.GetModelDirective(); |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, modelDirective); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void GetModelDirective_HostViewDataTypeNameIsEmptyString_ReturnsEmptyString() |
||||||
|
{ |
||||||
|
CreateEmptyViewTemplatePreprocessor(); |
||||||
|
mvcHost.ViewDataTypeName = String.Empty; |
||||||
|
|
||||||
|
string modelDirective = emptyViewTemplate.GetModelDirective(); |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, modelDirective); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue