System.Web.Profile.ProfileBase.ValidateProperty C# (CSharp) Method

ValidateProperty() static private method

static private ValidateProperty ( SettingsProperty settingsProperty, ElementInformation elementInfo ) : void
settingsProperty System.Configuration.SettingsProperty
elementInfo System.Configuration.ElementInformation
return void
		static void ValidateProperty (SettingsProperty settingsProperty, ElementInformation elementInfo)
		{
			string exceptionMessage = string.Empty;
			if (!AnonymousIdentificationModule.Enabled && 
				(bool) settingsProperty.Attributes ["AllowAnonymous"])
				exceptionMessage = "Profile property '{0}' allows anonymous users to store data. " +
					"This requires that the AnonymousIdentification feature be enabled.";

			if (settingsProperty.PropertyType == null)
				exceptionMessage = "The type specified for a profile property '{0}' could not be found.";

			if (settingsProperty.SerializeAs == SettingsSerializeAs.Binary &&
				!settingsProperty.PropertyType.IsSerializable)
				exceptionMessage = "The type for the property '{0}' cannot be serialized " +
					"using the binary serializer, since the type is not marked as serializable.";

			if (exceptionMessage.Length > 0)
				throw new ConfigurationErrorsException (string.Format (exceptionMessage, settingsProperty.Name),
					elementInfo.Source, elementInfo.LineNumber);
		}