Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebParts / WebPartUtil.cs / 2 / WebPartUtil.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Diagnostics; using System.Reflection; using System.Web.Compilation; internal static class WebPartUtil { // Called from WebPartManagerInternals and ConnectionsZone. internal static object CreateObjectFromType(Type type) { return HttpRuntime.FastCreatePublicInstance(type); } // We use BuildManager.GetType() instead of Type.GetType() so we can load types from the // Code directory, even if no assembly is specified. internal static Type DeserializeType(string typeName, bool throwOnError) { return BuildManager.GetType(typeName, throwOnError); } internal static Type[] GetTypesForConstructor(ConstructorInfo constructor) { Debug.Assert(constructor != null); ParameterInfo[] parameters = constructor.GetParameters(); Type[] types = new Type[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { types[i] = parameters[i].ParameterType; } return types; } internal static bool IsConnectionPointTypeValid(Type connectionPointType, bool isConsumer) { if (connectionPointType == null) { return true; } if (!(connectionPointType.IsPublic || connectionPointType.IsNestedPublic)) { return false; } Type baseType = isConsumer ? typeof(ConsumerConnectionPoint) : typeof(ProviderConnectionPoint); if (!connectionPointType.IsSubclassOf(baseType)) { return false; } Type[] constructorTypes = isConsumer ? ConsumerConnectionPoint.ConstructorTypes : ProviderConnectionPoint.ConstructorTypes; ConstructorInfo constructor = connectionPointType.GetConstructor(constructorTypes); if (constructor == null) { return false; } return true; } // This helper method used to be needed to resolve types in the Code directory. Since this // was fixed in internal static string SerializeType(Type type) { if (type.Assembly.GlobalAssemblyCache) { return type.AssemblyQualifiedName; } else { return type.FullName; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls.WebParts { using System; using System.Diagnostics; using System.Reflection; using System.Web.Compilation; internal static class WebPartUtil { // Called from WebPartManagerInternals and ConnectionsZone. internal static object CreateObjectFromType(Type type) { return HttpRuntime.FastCreatePublicInstance(type); } // We use BuildManager.GetType() instead of Type.GetType() so we can load types from the // Code directory, even if no assembly is specified. internal static Type DeserializeType(string typeName, bool throwOnError) { return BuildManager.GetType(typeName, throwOnError); } internal static Type[] GetTypesForConstructor(ConstructorInfo constructor) { Debug.Assert(constructor != null); ParameterInfo[] parameters = constructor.GetParameters(); Type[] types = new Type[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { types[i] = parameters[i].ParameterType; } return types; } internal static bool IsConnectionPointTypeValid(Type connectionPointType, bool isConsumer) { if (connectionPointType == null) { return true; } if (!(connectionPointType.IsPublic || connectionPointType.IsNestedPublic)) { return false; } Type baseType = isConsumer ? typeof(ConsumerConnectionPoint) : typeof(ProviderConnectionPoint); if (!connectionPointType.IsSubclassOf(baseType)) { return false; } Type[] constructorTypes = isConsumer ? ConsumerConnectionPoint.ConstructorTypes : ProviderConnectionPoint.ConstructorTypes; ConstructorInfo constructor = connectionPointType.GetConstructor(constructorTypes); if (constructor == null) { return false; } return true; } // This helper method used to be needed to resolve types in the Code directory. Since this // was fixed in internal static string SerializeType(Type type) { if (type.Assembly.GlobalAssemblyCache) { return type.AssemblyQualifiedName; } else { return type.FullName; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MethodRental.cs
- ResourcesBuildProvider.cs
- RoleManagerSection.cs
- RuntimeIdentifierPropertyAttribute.cs
- InstanceKeyView.cs
- Ray3DHitTestResult.cs
- RemotingServices.cs
- DataListGeneralPage.cs
- NavigationCommands.cs
- AttributeSetAction.cs
- SqlDataSourceFilteringEventArgs.cs
- ColorBuilder.cs
- DayRenderEvent.cs
- OutputCacheSettings.cs
- CodeSnippetTypeMember.cs
- CrossAppDomainChannel.cs
- PackagingUtilities.cs
- COMException.cs
- Comparer.cs
- CapabilitiesState.cs
- TypedDataSourceCodeGenerator.cs
- DataGridViewIntLinkedList.cs
- Vars.cs
- TemplateBaseAction.cs
- ReliableMessagingHelpers.cs
- Thickness.cs
- XmlDataSourceNodeDescriptor.cs
- PackageDigitalSignatureManager.cs
- activationcontext.cs
- MetadataFile.cs
- ExitEventArgs.cs
- DiffuseMaterial.cs
- XsdDateTime.cs
- BrowserCapabilitiesFactory.cs
- LinkArea.cs
- UserPreferenceChangingEventArgs.cs
- FontFamilyConverter.cs
- ObservableCollectionDefaultValueFactory.cs
- basenumberconverter.cs
- ProcessThreadDesigner.cs
- Int32KeyFrameCollection.cs
- WebColorConverter.cs
- CommandManager.cs
- FormViewModeEventArgs.cs
- ObjectConverter.cs
- DataErrorValidationRule.cs
- ObjectList.cs
- BuildResult.cs
- SchemaDeclBase.cs
- ChtmlCommandAdapter.cs
- TemplateComponentConnector.cs
- xml.cs
- ReflectionUtil.cs
- RoleGroupCollection.cs
- FolderBrowserDialog.cs
- SqlErrorCollection.cs
- MappingMetadataHelper.cs
- XmlBoundElement.cs
- TypeHelpers.cs
- WebPartConnectionsConfigureVerb.cs
- InstalledVoice.cs
- EntityDataSourceView.cs
- StoreAnnotationsMap.cs
- RequiredAttributeAttribute.cs
- StickyNoteAnnotations.cs
- SqlConnectionStringBuilder.cs
- TableLayoutPanelCellPosition.cs
- SimpleFileLog.cs
- Grant.cs
- ChildChangedEventArgs.cs
- DefaultTraceListener.cs
- TableSectionStyle.cs
- GetPageCompletedEventArgs.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- LayoutEvent.cs
- CodeRegionDirective.cs
- SrgsElementList.cs
- IisTraceListener.cs
- DataGridAddNewRow.cs
- StorageBasedPackageProperties.cs
- BidPrivateBase.cs
- Msmq.cs
- ThreadSafeMessageFilterTable.cs
- ToolStripOverflow.cs
- PolicyManager.cs
- ResourceCategoryAttribute.cs
- DesignerObject.cs
- ProfileParameter.cs
- ClientSession.cs
- LicenseProviderAttribute.cs
- MemberMemberBinding.cs
- SystemColorTracker.cs
- ReadOnlyDictionary.cs
- WinEventWrap.cs
- WeakRefEnumerator.cs
- TextAutomationPeer.cs
- StringAnimationBase.cs
- ProfileParameter.cs
- UpdateException.cs
- CollectionViewGroupRoot.cs