Somewhere in the code of my Gui I get the typedescriptor of an object.
This Type can describe some fo the .Net type (string, int32....) or an LLBLGen Pro EntityCollection (I'm using Adapter, with generics collection)
Said that I have the following code:
Dim T as Type
T=BindingSource.GetItemProperties(nothing).item(44).PropertyType '44 is EntityCollection2(Of MyAddressEntity)
How can i check if T represent an LLBLGen Pro EntityCollection?
The type of entity in the collection is not relevant. I only need to know if it is an LLBLGen EntityCollection.
I know that My entity collectionc inherits from EntityCollectionBase2(Of TEntity);
both EntityCollectionBase2 and EntityCollectionBase inherit from CollectionCore(Of TEntity);
also EntityCollectionNonGeneric inherit from EntityCollectionBase2(Of EntityBase2).
I'tried following code, without success; they all return False:
T is gettype(sd.LLBLGen.Pro.ORMSupportClasses.CollectionCore(Of))
T is gettype(sd.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2(Of))
T.GetGenericTypeDefinition is gettype(sd.LLBLGen.Pro.ORMSupportClasses.CollectionCore(Of))
T.GetGenericTypeDefinition is gettype(sd.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2(Of))
T.IsSubclassOf(gettype(sd.LLBLGen.Pro.ORMSupportClasses.CollectionCore(Of)))
T.IsSubclassOf(gettype(sd.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2(Of)))
T.GetGenericTypeDefinition .IsSubclassOf(gettype(sd.LLBLGen.Pro.ORMSupportClasses.CollectionCore(Of)))
T.GetGenericTypeDefinition .IsSubclassOf(gettype(sd.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2(Of)))
How can I do?
There must exist a simpe method to check the type (or the basetype) of a generic collection.
I don't wanna resor to some like T.BaseType.FullName Like "SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase*"
Thanks, Max