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
- DependencyPropertyKey.cs
- EntityDataReader.cs
- ChildTable.cs
- SQLDecimalStorage.cs
- ImageFormat.cs
- Compiler.cs
- MultiView.cs
- GeneralTransform3DCollection.cs
- BaseProcessor.cs
- CompilerGlobalScopeAttribute.cs
- HandleRef.cs
- SecurityTokenAuthenticator.cs
- IndexedString.cs
- Tuple.cs
- DependencyPropertyKey.cs
- HttpHandler.cs
- ControlTemplate.cs
- SafeNativeMethodsCLR.cs
- DataReceivedEventArgs.cs
- ICspAsymmetricAlgorithm.cs
- ValidationErrorEventArgs.cs
- HandlerFactoryCache.cs
- TcpConnectionPoolSettings.cs
- EditCommandColumn.cs
- BoundField.cs
- TypeSystemHelpers.cs
- EdmScalarPropertyAttribute.cs
- WebBrowserPermission.cs
- XmlReflectionMember.cs
- TextEndOfLine.cs
- TypeConverter.cs
- InputLanguageCollection.cs
- ContentDefinition.cs
- ZipIOLocalFileHeader.cs
- SecurityRuntime.cs
- XmlSchemaCompilationSettings.cs
- FormsIdentity.cs
- SafeWaitHandle.cs
- ProgressBarRenderer.cs
- HyperlinkAutomationPeer.cs
- XmlTextReader.cs
- DirectoryObjectSecurity.cs
- Vector3DIndependentAnimationStorage.cs
- ProgressPage.cs
- Triplet.cs
- EventLogPermission.cs
- FunctionCommandText.cs
- SortKey.cs
- PropertyMappingExceptionEventArgs.cs
- BitmapEffectDrawingContextState.cs
- XmlDataFileEditor.cs
- UnsafeMethods.cs
- HtmlButton.cs
- CachedBitmap.cs
- RegisteredHiddenField.cs
- CreateUserWizardStep.cs
- HandlerMappingMemo.cs
- ReliableSessionBindingElementImporter.cs
- MouseEvent.cs
- DependentList.cs
- BitVec.cs
- diagnosticsswitches.cs
- StylusPointPropertyId.cs
- TdsParserSafeHandles.cs
- ProtocolsConfigurationHandler.cs
- ProcessModuleCollection.cs
- XmlSchemaElement.cs
- PeekCompletedEventArgs.cs
- ResolveCriteria11.cs
- XmlBinaryReader.cs
- SR.cs
- StringAttributeCollection.cs
- StylusPointPropertyId.cs
- SplitterPanel.cs
- CompletionBookmark.cs
- ThreadInterruptedException.cs
- ColorConvertedBitmap.cs
- ProcessRequestArgs.cs
- TextSyndicationContentKindHelper.cs
- Delegate.cs
- dbenumerator.cs
- DataTableMapping.cs
- MimeBasePart.cs
- ConfigXmlDocument.cs
- SettingsAttributes.cs
- Rijndael.cs
- DependencySource.cs
- AudioFormatConverter.cs
- IdentityModelDictionary.cs
- TransportManager.cs
- DataBindingHandlerAttribute.cs
- ToolStripSplitButton.cs
- SamlAssertion.cs
- unsafenativemethodstextservices.cs
- XmlSignificantWhitespace.cs
- SetStateEventArgs.cs
- ProgressChangedEventArgs.cs
- RelationshipFixer.cs
- DrawingCollection.cs
- QueryOptionExpression.cs