Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Activation / ServiceBuildProvider.cs / 1 / ServiceBuildProvider.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activation { using System; using System.CodeDom; using System.CodeDom.Compiler; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Web.Compilation; using System.Security; using System.Web; using System.Security.Permissions; using System.Threading; ////// Critical - entry-point from asp.net, called outside PermitOnly context /// also needs to elevate in order to inherit from BuildProvider and call methods on the base class /// [SecurityCritical(SecurityCriticalScope.Everything)] [BuildProviderAppliesTo(BuildProviderAppliesTo.Web)] [ServiceActivationBuildProvider] class ServiceBuildProvider : BuildProvider { ServiceParser parser; public override CompilerType CodeCompilerType { get { return GetCodeCompilerType(); } } CompilerType GetCodeCompilerType() { EnsureParsed(); return parser.CompilerType; } protected override CodeCompileUnit GetCodeCompileUnit(out IDictionary linePragmasTable) { CodeSnippetCompileUnit ccu = parser.GetCodeModel() as CodeSnippetCompileUnit; linePragmasTable = parser.GetLinePragmasTable(); return ccu; } void EnsureParsed() { if (parser == null) { parser = new ServiceParser(VirtualPath, this); parser.Parse(ReferencedAssemblies); } } public override BuildProviderResultFlags GetResultFlags(CompilerResults results) { return BuildProviderResultFlags.ShutdownAppDomainOnChange; } public override void GenerateCode(AssemblyBuilder assemblyBuilder) { GenerateCodeCore(assemblyBuilder); } void GenerateCodeCore(AssemblyBuilder assemblyBuilder) { if (assemblyBuilder == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assemblyBuilder"); } CodeCompileUnit codeCompileUnit = parser.GetCodeModel(); // Bail if we have nothing we need to compile // if (codeCompileUnit == null) return; // Add the code unit and then add all the assemblies // assemblyBuilder.AddCodeCompileUnit(this, codeCompileUnit); if (parser.AssemblyDependencies != null) { foreach (Assembly assembly in parser.AssemblyDependencies) { assemblyBuilder.AddAssemblyReference(assembly); } } } public override string GetCustomString(CompilerResults results) { return GetCustomStringCore(results); } string GetCustomStringCore(CompilerResults results) { return parser.CreateParseString((results == null) ? null : results.CompiledAssembly); } public override System.Collections.ICollection VirtualPathDependencies { get { return parser.SourceDependencies; } } internal CompilerType GetDefaultCompilerTypeForLanguageInternal(string language) { return GetDefaultCompilerTypeForLanguage(language); } internal CompilerType GetDefaultCompilerTypeInternal() { return GetDefaultCompilerType(); } internal TextReader OpenReaderInternal() { return OpenReader(); } } } // 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
- DataGridViewSortCompareEventArgs.cs
- WebSysDefaultValueAttribute.cs
- CommandLineParser.cs
- HtmlProps.cs
- TreeViewImageIndexConverter.cs
- DocumentXmlWriter.cs
- SingleStorage.cs
- XmlNodeChangedEventManager.cs
- AttachedAnnotation.cs
- ListViewHitTestInfo.cs
- IntegerValidator.cs
- Interlocked.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- TextServicesPropertyRanges.cs
- SkinBuilder.cs
- clipboard.cs
- Blend.cs
- UrlPath.cs
- RootAction.cs
- CodeTypeParameterCollection.cs
- AssemblyCollection.cs
- TabletDevice.cs
- MessageDesigner.cs
- OrderedDictionary.cs
- DynamicDataRoute.cs
- ColorMatrix.cs
- ListBoxChrome.cs
- MediaEntryAttribute.cs
- DbConnectionHelper.cs
- MostlySingletonList.cs
- UserCancellationException.cs
- DoubleCollection.cs
- CodeRemoveEventStatement.cs
- SiteMapProvider.cs
- _UriSyntax.cs
- OutputWindow.cs
- CodeTypeReferenceCollection.cs
- DesignerVerbCollection.cs
- StylusPointPropertyId.cs
- SaveFileDialog.cs
- CopyCodeAction.cs
- VirtualizingPanel.cs
- PropertyItemInternal.cs
- HelpKeywordAttribute.cs
- SymmetricKeyWrap.cs
- StrongNameIdentityPermission.cs
- TextEffectResolver.cs
- InvalidOleVariantTypeException.cs
- PageBuildProvider.cs
- CultureData.cs
- iisPickupDirectory.cs
- EtwTrace.cs
- ConfigurationPropertyCollection.cs
- TagMapInfo.cs
- FixedSOMElement.cs
- SapiRecognizer.cs
- BaseCAMarshaler.cs
- SetUserPreferenceRequest.cs
- AspCompat.cs
- TextEditor.cs
- EntityCommandDefinition.cs
- WebConfigurationManager.cs
- OracleTimeSpan.cs
- ScriptBehaviorDescriptor.cs
- IUnknownConstantAttribute.cs
- MouseButtonEventArgs.cs
- QilValidationVisitor.cs
- BaseUriHelper.cs
- HelpKeywordAttribute.cs
- BufferedOutputStream.cs
- FontCollection.cs
- GridViewRowPresenterBase.cs
- HtmlObjectListAdapter.cs
- OleDbPropertySetGuid.cs
- MailHeaderInfo.cs
- LineServicesCallbacks.cs
- ExtenderProvidedPropertyAttribute.cs
- DetailsView.cs
- IndexedString.cs
- HwndHost.cs
- DirectoryObjectSecurity.cs
- LiteralTextContainerControlBuilder.cs
- SecureConversationDriver.cs
- SubtreeProcessor.cs
- WindowsTokenRoleProvider.cs
- DataGridRelationshipRow.cs
- InfoCardCryptoHelper.cs
- AssemblyBuilder.cs
- DataListItemEventArgs.cs
- XamlGridLengthSerializer.cs
- XmlStreamStore.cs
- ObjectSecurity.cs
- LicenseException.cs
- ProvideValueServiceProvider.cs
- TextElementEnumerator.cs
- ModifierKeysConverter.cs
- DbParameterHelper.cs
- IISMapPath.cs
- SessionStateContainer.cs
- Compress.cs