Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Using generics and nested classes for base view types
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Don  
View profile   Translate to Translated (View Original)
 More options Jun 26 2012, 1:15 pm
From: Don <don.lavelle.b...@gmail.com>
Date: Tue, 26 Jun 2012 10:15:04 -0700 (PDT)
Local: Tues, Jun 26 2012 1:15 pm
Subject: Using generics and nested classes for base view types

I'm trying to use Spark as a general rendering engine, similar to what is
done in this example<http://whereslou.com/2008/12/16/using-spark-as-a-general-purpose-temp...>.  
However, I'd like to be able to use a nested class within a generic as the
base type, as in:

public class SparkEmailRenderer<DataType>

My very simple test case is this:

[TestMethod]

I keep getting a dynamic view compilation error on public class
View3d480988a882485c98ed589523d9e8b4 :
Full.Name.For.SparkEmailRenderer`1+RendererView[[Full.Name.For.SampleData,
Test.Assembly.Name, Version=2.0.2.0, Culture=neutral,
PublicKeyToken=c5e39879b2509991]]

If I change the line about SparkSettings settings = new
SparkSettings().SetPageBaseType(typeof(RendererView)); to just be the
string literal
Full."Name.For.SparkEmailRenderer.RendererView<Full.Name.For.SampleData>",
it works, but that obviously won't work in the real world.

Any ideas on how to get that class name to render correctly?  Do I have to
do it myself, or is there a way to get Spark to figure it out?

Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don  
View profile  
 More options Jun 27 2012, 1:19 pm
From: Don <don.lavelle.b...@gmail.com>
Date: Wed, 27 Jun 2012 10:19:46 -0700 (PDT)
Local: Wed, Jun 27 2012 1:19 pm
Subject: Re: Using generics and nested classes for base view types

So after some digging, I found how to get the C# name of a type on
stackoverflow<http://stackoverflow.com/questions/4615553/c-sharp-get-user-friendly-...>using

SparkViewDescriptor descriptor = new SparkViewDescriptor();

> descriptor.SetLanguage(LanguageType.CSharp);
> String typeName = new
> Microsoft.CSharp.CSharpCodeProvider().GetTypeOutput(new
> System.CodeDom.CodeTypeReference(typeof(RendererView)));
> SparkSettings settings = new SparkSettings().SetPageBaseType(typeName);

to get the proper name.  It works for me.  Would there be any issue if
someone were to use my assembly with a  VB project?

Thanks,

    Don


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob G  
View profile  
 More options Jul 7 2012, 3:13 am
From: Rob G <robertgreyl...@gmail.com>
Date: Sat, 7 Jul 2012 08:13:52 +0100
Local: Sat, Jul 7 2012 3:13 am
Subject: Re: Using generics and nested classes for base view types

Hi Don,

If you're using precompiled views with an assembly output, then I don't see
an issue calling it from VB.NET. Also, if you're rendering views on the
fly, then the C# compiler is used by default, which you can change to use
the Visual Basic compiler - take a look here:
http://sparkviewengine.com/documentation/visualbasic

Hope that answers your question...
Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »