Hi,
I am building a newsletter service that uses spark to generate the
HTML.
I can get Spark to work fine in my standalone application if the
DefaultPageBaseType is a simple class inheriting from SparkViewBase
So I have a ViewData class inheriting from SparkViewBase with a Model
property of type EmailData containing all the info to build up the
html, I then access it in the view with Model.Xxx
What I would like is to have the ViewData class agnostic of the model
it is going to present to the view.
So I changed my code to be as follow :
public class ViewData<T> : SparkViewBase
{
public T Model {get; set;}
}
In the constructor of my HtmlBuilder<T> (T being the Model) I
instanciate the engine like that:
engine = new SparkViewEngine(setup);
engine.DefaultPageBaseType = typeof(ViewData<T>).FullName;
And finally to create my view I do :
var view = (ViewData<T>)engine.CreateInstance(descriptor);
Everything seems ok but at runtime :
Unhandled Exception: Spark.Compiler.CompilerException: Dynamic view
compilation
failed.
\Temp\hxntjkr1.0.cs(10,81): error CS1056: Unexpected character '`'
l\Temp\hxntjkr1.0.cs(10,81): error CS1514: { expected
\Temp\hxntjkr1.0.cs(10,81): error CS1519: Invalid token '`' in class,
struct, or interface member declaration
\Temp\hxntjkr1.0.cs(10,84): error CS1001: Identifier expected
\Temp\hxntjkr1.0.cs(10,145): error CS1003: Syntaxerror, ']' expected
\Temp\hxntjkr1.0.cs(10,145): error CS1519: Invalid token '=' in class,
struct, or interface member declaration
\Temp\hxntjkr1.0.cs(10,162): error CS1519: Invalid token '=' in class,
struct, or interface member declaration
\Temp\hxntjkr1.0.cs(10,170): error CS1519: Invalid token ',' in class,
struct, or interface member declaration
\Temp\hxntjkr1.0.cs(10,186): error CS1519: Invalid token '=' in class,
struct, or interface member declaration
From what I understand Spark doesnt understand the <> and the []given
by typeof(ViewData<T>).FullName due to the special character generated
by generics.
But this is working when used in MVC right? (I assume) So how can I
get this to work in my standalone app?
Thanks for help,
Stéphane
--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to
spar...@googlegroups.com.
To unsubscribe from this group, send email to
spark-dev+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/spark-dev?hl=en.