Generics and ASP.Net Membership Provider

I am trying to use a generic list as a user profile property. I admit that this most likely makes my life harder than necessary, but I don't want to change the programming model just because the data warehouse is struggling.

I have it in my web.config

</providers> <properties> ..... <add name="AListProperty" type="System.Collections.Generic.List`1[[System.Int32]]"/> <add name="AnotherListProperty" type="System.Collections.Generic.List`1[[MyNamespace.Web.UI.MyReallySimpleClass]]"> </properties> </profile> 

The first property, "AListProperty" works fine. The second option raises many exceptions, depending on how I deal with this in web.config. MyReallySimpleClass is public, serializable and consists of 2 open fields (currently)

So my questions are: 1. Does anyone know where the declaration format of these types in web.config is documented. 2. What am I doing wrong? It looks great, I do not see differences in semantics between the two declarations.

thanks

+4
source share
2 answers

This will help if you can also provide some information about the types of exceptions and the message you are experiencing. Otherwise, I assumed that you might need to qualify MyNamespace.Web.UI.MyReallySimpleClass using the assembly where the type is located, as in MyNamespace.Web.UI.MyReallySimpleClass, MyAssembly . Assembly qualification is not required if the type does not live in mscorlib and System.Int32 in App_Code or in one of the assemblies listed in the system.web/compilation/assemblies section of the configuration.

  • Does anyone know where the format for declaring these types in web.config is documented.

See Specifying Fully Qualified Type Names on MSDN.

+3
source

Try specifying the assembly YourReallySimpleClass:

 ...type="System.Collections.Generic.List`1[[MyNamespace.Web.UI.MyReallySimpleClass, MyAssemblyName]]" 
+3
source

All Articles