Root / Assembly / ARCCore / Class / Extensions / _Member / ToStringDB

ClassMemberAttribute

ToStringDB

KeyValue
DescriptionGives the minimum representation of type as string suitable for later reconstruction by -GetType-.
(that is with namespace and including all relevant assembly names but nothing more)
The returned string even takes into consideration generics when the generic type resides in a different assembly.

The return value is considered SQL-"safe" in the sense that it may be inserted directly into an SQL statement (not relevant for new AgoRapide (2020) though).

Corresponding method for getting the type back is TryGetTypeFromStringFromCache.

Note how caches result since operation is somewhat complicated due do generic types.
Note how returns a string.Intern in order to make for quicker dictionary lookup as returned string will often be used for lookup in other caches.
LongDescriptionTODO: GIVE BETTER EXAMPLE below because ApplicationPart does not exist in new AgoRapide (2020).

Example of return value is:
ApplicationPart<P>; : AgoRapide.ApplicationPart`1[AgoRapideSample.P,AgoRapideSample],AgoRapide
(the part before : is what is returned by ToStringShort and serves as a human readable shorthand)

Note complexities involved around generic types where the generic argument exist in a different assembly.
For instance for:
typeof(AgoRapide.ApplicationPart{AgoRapideSample.P})
where ApplicationPart resides in AgoRapide and
P resides in AgoRapideSample a simple approach like
ToString , Assembly.-GetName-
would give
AgoRapide.ApplicationPart`1[AgoRapideSample.P],AgoRapide
which is not enough information for -GetType-

Therefore, for types where generic arguments exist in a different assembly we have to do like explained here:
http://stackoverflow.com/questions/2276384/loading-a-generic-type-by-name-when-the-generics-arguments-come-from-multiple-as

In our case what is returned by this methdod is something like mentioned above
AgoRapide.ApplicationPart`1[AgoRapideSample.P,AgoRapideSample],AgoRapide
that is, we insert the assembly name where the type of the generic parameter resides, into the string.
MethodNameToStringDB
MethodSignatureSystem.String ToStringDB(System.Type)
ReflectedTypeARCCore.Extensions

5 items


Generated 2020-10-13 11:11:03.723 UTC