Feed aggregator

Re: Viewdata in Application.spark

Discussion Group - 14 min 29 sec ago
I have not used IQueryable, but I know IEnumerable or IList will work. You
just add a viewdata tag to the top of the view as such:
<viewdata model='IList[[MenuItem]]' />
you can then access the model property as in webforms view engine. There is
much more documentation on it at the spark website.
Hope this helps.

Precompiling to static assembly in .NET 4.0

Discussion Group - 14 min 30 sec ago
I've recently run into an issue where the first time my app loads it
dynamically compiles correctly ... but after the app pool recycles
isn't able to resolve all referenced assemblies. Quite similar to the
problem discussed here: [link].

Re: Viewdata in Application.spark

Discussion Group - 14 min 30 sec ago
I'm not sure of the best way. But the way I might use would be to
(using .Net 3.5):

1) Make a MenuItemViewMode.cs with needed properties like Text and
Link (or just use your MenuItem if just a DTO).
2) Add a BuildMenuList.cs filter that in OnActionExecuting does your
query, maps each MenuItem to MenuItemViewModel, and sets

Viewdata in Application.spark

Discussion Group - 14 min 30 sec ago
Hello,

I have written this in the mode/menu.cs file:

IQueryable<MenuItem> ViewMenu()
{
return from ost in db.MenuItems
orderby ost.SortID
select ost;
}

I want to use this in the application.spark file to view the menu on

Re: SparkViewEngine spontaneous NullReferenceException while rendering view

Discussion Group - 14 min 30 sec ago
I can't reproduce it when i start a new project with just a simple
master and some dummy childactions / partial views.
If i ever get more time to look at it i will think about stripping
down the project until the exception dissapears, hopefully pinpointing
the exact spot of the problem this way.

Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]

Discussion Group - 14 min 30 sec ago
I don't think we need warnings in generated classes.
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).

Commented Issue: Force CompilerParameters.TreatWarningsAsErrors = false in BatchCompiler.Compile() [3873]

Discussion Group - 14 min 30 sec ago
I don't think we need warnings in generated classes.
By default TreatWarningsAsErrors = (WarningLevel > 0).
I don't want to touch WarningLevel in my system.codedom section, and <providerOption name="WarnAsError" value="false" /> is taken into account only for Web Forms compilation.
So it will be nice to to set TreatWarningsAsErrors = false in code. Or at least read the provider <providerOption name="WarnAsError" value="false" /> (unfortunately it is internal so read is only possible via reflection).

Re: Warning as Error

Discussion Group - 14 min 30 sec ago
Actually, depending on the warning you may have to drop it lower. Mea
culpa. Easier still is to drop the <system.codedom> section unless
you have need of customizing it.

Re: Warning as Error

Discussion Group - 14 min 30 sec ago
Note to people getting these errors: Check your web.config
system.codedom section for warningLevel="4", which equates to telling
the compiler to treat all warnings as errors. Drop it down to 3.

Re: Warning as Error

Discussion Group - 14 min 30 sec ago
Bump. I'm getting the same thing with a section of code I've
temporarily disabled with an <if condition="false"> block.

I'd love to have this be configurable, as my spark compilation
integration tests would benefit greatly from finding warnings as
errors (which they currently don't--with the same web.config section,

Re: Bindings

Discussion Group - 14 min 30 sec ago
Just to clarify. It seems to be all binding that actually pass data -
as part of a dictionary, as part of viewdata or even the viewdata
model itself.

Is it possilbe I may need to change a setting somewhere?

Cheers

Re: Bindings

Discussion Group - 14 min 30 sec ago
Hi Guys,

Thanks for the replies and sorry to sound like a bit of a hassle.

I really like the idea of bindings hence perservering with them.
Having tried Louis' lates suggestion I get the error:

error CS1040: Preprocessor directives must appear as the first non-
whitespace character on a line

RE: Bindings

Discussion Group - 14 min 30 sec ago
The binding might be okay,
<element name="partial">#Html.RenderPar tial("@name", @data)</element>
But I think your usage might need some adjustments around the quoting of attributes...
<partial name="'FeedbackPageTable'" data=Model />
Try:
<partial name="FeedbackPageTable" data="Model" />
-----Original Message-----

Re: Bindings

Discussion Group - 14 min 30 sec ago
use the viewdata element in your partial:
[link]

Re: Bindings

Discussion Group - 14 min 30 sec ago
Thanks for the reply. I have not noticed this on the spark docs.

Is there a property for passing a model to the partial?

Re: Bindings

Discussion Group - Fri, 09/10/2010 - 02:12
Typing this from my iPhone since I'm on vacation without internet so here goes:
Html.RenderPartial (to my knowledge) is the MSMVC helper used when rendering ascx partials. In your case, if your partial is a spark partial, then you don't need Bindings, you can just call it by typing <FeedbackPageTable/>

Bindings

Discussion Group - Fri, 09/10/2010 - 02:12
First off: I love them!

Secondly: I cannot get them to work correctly in some cases.

I have tried to create a partial binding that renders a partial view
by passing a name and a model:

Binding:
<element name="partial">#Html.RenderPar tial("@name", @data)</element>

Code that I want it to replace in my view:

Commented Issue: SparkSense throws an exception whenever it runs [6846]

Discussion Group - Tue, 09/07/2010 - 22:17
Whenever I type "${", or "<s:" or just press Ctrl-Space I get the the exception below:

279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe

Commented Issue: SparkSense throws an exception whenever it runs [6846]

Discussion Group - Sat, 09/04/2010 - 18:41
Whenever I type "${", or "<s:" or just press Ctrl-Space I get the the exception below:

279 ERROR System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgume ntException(ExceptionResource resource) at System.Collections.Generic.Dic tionary`2.Insert(TKey key, TValue value, Boolean add) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.ScanProjectItemForViews(P rojectItem projectItem) at SparkSense.Parsing.ProjectExpl orer.BuildViewMapFromProjectEn vironment() at SparkSense.Parsing.ProjectExpl orer.get_ProjectViewFolder() at SparkSense.Parsing.ProjectExpl orer.GetViewFolder() at SparkSense.Parsing.ViewExplore r.InitCurrentView() at SparkSense.Parsing.ViewExplore r..ctor(IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionSource..ctor(ITextB uffer textBuffer, IProjectExplorer projectExplorer) at SparkSense.StatementCompletion .CompletionListe

An assembly with the same simple name.. side-by-side

Discussion Group - Thu, 09/02/2010 - 02:38
Reporting this again as more users of Spark now hopefully.

Happens about 1 in every 3 debugging attempts. Usually a clean,
rebuild, iisreset, rebuild sorts it but its bloody annoying and only
ever happens when using Spark.

I've had this in both .Net 4.0 and .Net 3.5 on two dev machines and
occasionally on server (when not stoppping app pools before copying).

Syndicate content