[Mono-aspnet-list] Razor EditorTemplates with mono 3.2.8
Niels Heinemann
heinemann at kompetenzz.de
Fri Jul 11 12:05:08 UTC 2014
Hi there,
I'm running an Asp.NET MVC site with Nuget packages for
Microsoft.AspNet.Mvc 4.0.0.0 developed with MonoDevelop 5.3.
Mono's or Microsoft's EntityFramework ist not involved for now
but since I tried to use a custom EditorTemplate in a razor view,
System.Web.MVC throws
System.IO.FileNotFoundException
Could not load file or assembly 'System.Data.Entity,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
or one of its dependencies.
on page load. The stack trace is printed below¹. My code also².
I tried to find a referencable System.Data.Entity.dll but I had no
luck. Mono's distribution of EntityFramework seems not to work as
well. And I just can't figure out why the System.Data.Entity is
referenced at this point.
Could someone please give me a hint?
Or do you need any more information?
Thanks in advance // nielo
¹) StackTrace:
====8<---------------------
at System.Web.Mvc.Html.DefaultEditorTemplates+<>c__DisplayClass6.<ObjectTemplate>b__5 (System.Web.Mvc.ModelMetadata pm) [0x00000] in <filename unknown>:0 at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[System.Web.Mvc.ModelMetadata].MoveNext () [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.DefaultEditorTemplates.ObjectTemplate (System.Web.Mvc.HtmlHelper html, System.Web.Mvc.Html.TemplateHelperDelegate templateHelper) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.DefaultEditorTemplates.ObjectTemplate (System.Web.Mvc.HtmlHelper html) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplate (System.Web.Mvc.HtmlHelper html, System.Web.Mvc.ViewDataDictionary viewData, System.String templateName, DataBoundControlMode mode, System.Web.Mvc.Html.GetViewNamesDelegate getViewNames, System.Web.Mvc.Html.GetDefaultActionsDelegate getDefaultActions) [0x00000] in <filename unknown>:0 at (wrapper delegate-invoke) <Module>:invoke_string__this___HtmlHelper_ViewDataDictionary_string_DataBoundControlMode_TemplateHelpers/GetViewNamesDelegate_TemplateHelpers/GetDefaultActionsDelegate (System.Web.Mvc.HtmlHelper,System.Web.Mvc.ViewDataDictionary,string,System.Web.UI.WebControls.DataBoundControlMode,System.Web.Mvc.Html.TemplateHelpers/GetViewNamesDelegate,System.Web.Mvc.Html.TemplateHelpers/GetDefaultActionsDelegate) at System.Web.Mvc.Html.TemplateHelpers.TemplateHelper (System.Web.Mvc.HtmlHelper html, System.Web.Mvc.ModelMetadata metadata, System.String htmlFieldName, System.String templateName, DataBoundControlMode mode, System.Object additionalViewData, System.Web.Mvc.Html.ExecuteTemplateDelegate executeTemplate) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.TemplateHelpers.TemplateHelper (System.Web.Mvc.HtmlHelper html, System.Web.Mvc.ModelMetadata metadata, System.String htmlFieldName, System.String templateName, DataBoundControlMode mode, System.Object additionalViewData) [0x00000] in <filename unknown>:0 at (wrapper delegate-invoke) <Module>:invoke_string__this___HtmlHelper_ModelMetadata_string_string_DataBoundControlMode_object (System.Web.Mvc.HtmlHelper,System.Web.Mvc.ModelMetadata,string,string,System.Web.UI.WebControls.DataBoundControlMode,object) at System.Web.Mvc.Html.TemplateHelpers.TemplateFor[SchoolModel,AddressModel] (System.Web.Mvc.HtmlHelper`1 html, System.Linq.Expressions.Expression`1 expression, System.String templateName, System.String htmlFieldName, DataBoundControlMode mode, System.Object additionalViewData, System.Web.Mvc.Html.TemplateHelperDelegate templateHelper) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.TemplateHelpers.TemplateFor[SchoolModel,AddressModel] (System.Web.Mvc.HtmlHelper`1 html, System.Linq.Expressions.Expression`1 expression, System.String templateName, System.String htmlFieldName, DataBoundControlMode mode, System.Object additionalViewData) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.EditorExtensions.EditorFor[SchoolModel,AddressModel] (System.Web.Mvc.HtmlHelper`1 html, System.Linq.Expressions.Expression`1 expression) [0x00000] in <filename unknown>:0 at ASP._Page_Views_School_Index_cshtml.Execute () [0x000f8] in /home/nielo/projekte/kompetenzz/ASP.NET/Kompi.GirlsDay.NET_MVC-4.5/src/Kompi.GirlsDay.Web/Views/School/Index.cshtml:9 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy () [0x00000] in <filename unknown>:0 at System.Web.Mvc.WebViewPage.ExecutePageHierarchy () [0x00000] in <filename unknown>:0 at System.Web.WebPages.StartPage.RunPage () [0x00000] in <filename unknown>:0 at System.Web.WebPages.StartPage.ExecutePageHierarchy () [0x00000] in <filename unknown>:0 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy (System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) [0x00000] in <filename unknown>:0 at System.Web.Mvc.RazorView.RenderView (System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer, System.Object instance) [0x00000] in <filename unknown>:0 at System.Web.Mvc.BuildManagerCompiledView.Render (System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17 () [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter (IResultFilter filter, System.Web.Mvc.ResultExecutingContext preContext, System.Func`1 continuation) [0x00000] in <filename unknown>:0
====8<---------------------
²) Code:
====8<---------------------
Models/SchoolModel.cs:
public class SchoolModel : BaseModel
{
[Required(ErrorMessage="Bitte geben Sie einen Schulnamen an.")]
public string Name { get; set; }
public AddressModel Address { get; set; }
}
====8<---------------------
Models/AddressModel.cs:
public class AddressModel : BaseModel
{
[Required(ErrorMessage="Bitte geben Sie einen Organisationsnamen an.")]
public string Name { get; set; }
}
====8<---------------------
Views/School/Index.cshtml:
@model Kompi.GirlsDay.Web.Models.SchoolModel
<div>
@Html.LabelFor(x => x.Name):
@Html.EditorFor(x => x.Name)
</div>
@Html.EditorFor(x => x.Address)
====8<---------------------
Views/Shared/EditorTemplates/Address.cshtml:
@model Kompi.GirlsDay.Web.Models.AddressModel
<div>
@Html.LabelFor(m => m.Name):
@Html.EditorFor(m => m.Name)
</div>
====8<---------------------
--
Kompetenzzentrum Technik-Diversity-Chancengleichheit
Girls'Day - Mädchen-Zukunftstag | Technik
Wilhelm-Bertelsmann-Str. 10, 33602 Bielefeld
Tel. +49 521 106-73 56 | Fax: +49 521 106-71 71
heinemann at kompetenzz.de
www.kompetenzz.de
www.girls-day.de
*2015 findet der Girls'Day am 23. April statt.*
*Girls'Day Online-Shop* http://material.kompetenzz.net/girls-day
Hier können Sie den Girls'Day Newsletter abonnieren.
http://www.girls-day.de/newsletter/subscribe
Das Projekt Girls'Day - Mädchen-Zukunftstag wird gefördert vom
Bundesministerium für Bildung und Forschung und vom
Bundesministerium für Familie, Senioren, Frauen und Jugend
Kompetenzzentrum Technik-Diversity-Chancengleichheit e.V.
Vorsitzende: Prof. Barbara Schwarze - Geschäftsführung:
Doro-Thea Chwalek - Martina Köppke - Dr. Ulrike Struwe
Vereinssitz: Wilhelm-Bertelsmann-Str. 10, 33602 Bielefeld
eingetragen beim Amtsgericht Bielefeld, VR-Nr. 3811
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20140711/82fd3b7b/attachment.pgp>
More information about the Mono-aspnet-list
mailing list