Generic types
How can I get the ITypeElement of a generic type if I have the typename
as a full qualified string like "Wrapper`1[Customer]" ?
I tried
- IDeclarationsCache.GetTypeElementByCLRName
- IDeclarationsCache.GetElementsByShortName
- IDeclarationsCache.GetElementsAtQualifiedName
with no success.
Regards,
Stefan Lieser
--
http://nhplugin.lieser-online.de
Please sign in to leave a comment.
I see general misunderstanding.
There are 2 major hierarchies:
1) hierarchy of type elements (i.e. classes, interfaces). All of them have
ITypeElement in root
2) hierarchy of constructed types: such ass arrays of classes, generic
classes with exact substitution (T->int, for example), and so on. They grow
from "IType" interface.
You can create "constructed type" from ITypeElement and substitution using
methods from "TypeFactory" class
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Stefan Lieser" <stefan@lieser-online.de> wrote in message
news:g3tr60$657$1@is.intellij.net...
>
>
An NHibernate mapping file maps a property to a database column.
Optional you can specify the properties type in the mapping file. So
what I would like to do is to compare the type of the property with the
type specified. The problem is that generic types have to be specified
in die CLR naming convention in NH mapping files
(Examples.Wrapper`1[Examples.Customer] for example). So I need to get
IType or ITypeElement for the string representation of the generic type
name. How?
Eugene Pasynkov (JetBrains) schrieb:
Any idea how to accomplish that??
Stefan Lieser schrieb:
>> I see general misunderstanding.
>>
>> There are 2 major hierarchies:
>> 1) hierarchy of type elements (i.e. classes, interfaces). All of them
>> have ITypeElement in root
>> 2) hierarchy of constructed types: such ass arrays of classes, generic
>> classes with exact substitution (T->int, for example), and so on. They
>> grow from "IType" interface.
>>
>> You can create "constructed type" from ITypeElement and substitution
>> using methods from "TypeFactory" class
>>
In this case you have to manually parse that given line, then get
ITypeElements via CLR name, and construct IType.
For example, in you line "Examples.Wrapper`1[Examples.Customer]" there are 2
type elements:
Examples.Wrapper`1 and Examples.Customer
If you need further assitance to get ITypeElements, do not hesitate to ask
ne for details
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Stefan Lieser" <stefan@lieser-online.de> wrote in message
news:g40pof$6gk$1@is.intellij.net...
>
>> I see general misunderstanding.
>>
>> There are 2 major hierarchies:
>> 1) hierarchy of type elements (i.e. classes, interfaces). All of them
>> have ITypeElement in root
>> 2) hierarchy of constructed types: such ass arrays of classes, generic
>> classes with exact substitution (T->int, for example), and so on. They
>> grow from "IType" interface.
>>
>> You can create "constructed type" from ITypeElement and substitution
>> using methods from "TypeFactory" class
>>