Missing reference

Jun 20, 2015 at 1:27 AM
Edited Jun 20, 2015 at 1:31 AM
I'm getting ...

There was an error while rendering the template: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The call is ambiguous between the following methods or properties: 'ToSic.SexyContent.Razor.SexyContentWebPage.AsDynamic(System.Collections.Generic.IDictionary<int,ToSic.Eav.IEntity>)' and 'ToSic.SexyContent.Razor.SexyContentWebPage.AsDynamic(System.Collections.Generic.IEnumerable<ToSic.Eav.IEntity>)' at CallSite.Target(Closure , CallSite , _Page_Portals_0_2sxc_NADA_Data__NADAChartTemplate_cshtml , Object ) at ASP._Page_Portals_0_2sxc_NADA_Data__NADAChartTemplate_cshtml.Execute() in c:\inetpub\vhosts\test1.patapscoresearch.com\httpdocs\Portals\0\2sxc\NADA_Data_NADAChartTemplate.cshtml:line 13

Line 13 is: var theChart = AsDynamic(@Content.ChartType); ChartType is a field in the content item that is of type Entity.
Jun 20, 2015 at 1:47 AM
I think that I need to add some more code:

@using DotNetNuke.Entities.Portals;
@using DotNetNuke.Entities.Tabs;
@using ToSic.Eav;
@using ToSic.Eav.DataSources;

var allCharts = CreateSource<EntityIdFilter>();
allCharts.EntityIds = "[QueryString:eid]";
var theEntity = allCharts.List.FirstOrDefault().Value;
var Content = AsDynamic(theEntity);

var dataFile = Server.MapPath(Content.FileName);
var theChart = AsDynamic(Content.ChartType);
var theArrow = AsDynamic(Content.SummaryArrow);


This was working fine when I was specifiying the Chart content to be used. I'm trying to switch to passing in the EntityId of the content using a querystring variable. Now I am getting the ambiguous error.
Jun 22, 2015 at 6:27 AM
There are multiple commands called AsDynamic - each trying to give you a simple, dynamic object back. Apparently the compiler has issues figuring out which one to use - because he can't reliably guess what type "theEntity" will have.

Your simplest solution is probably to tell it what type it is, like
IEntity theEntity = allCharts.List.FirstOrDefault().Value;
Jun 23, 2015 at 12:58 AM
Bad data = bad results. See my other thread with the same title!
Marked as answer by jncraig on 6/22/2015 at 5:58 PM