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
- ProgressiveCrcCalculatingStream.cs
- XmlUTF8TextWriter.cs
- LogManagementAsyncResult.cs
- DataPager.cs
- CurrencyManager.cs
- CodeTypeDeclarationCollection.cs
- BamlRecords.cs
- SaveFileDialogDesigner.cs
- SignatureResourceHelper.cs
- VisualTreeUtils.cs
- CqlLexerHelpers.cs
- ContentHostHelper.cs
- SurrogateChar.cs
- DispatcherExceptionFilterEventArgs.cs
- ActivityInfo.cs
- TagMapInfo.cs
- IgnoreFlushAndCloseStream.cs
- WebPartCatalogCloseVerb.cs
- ImageButton.cs
- Types.cs
- Identifier.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- XmlDataLoader.cs
- Deflater.cs
- XamlHostingConfiguration.cs
- COM2Properties.cs
- MappingItemCollection.cs
- SchemaContext.cs
- StringValidatorAttribute.cs
- DbConnectionInternal.cs
- DateTimeConverter2.cs
- TreeView.cs
- DataProtection.cs
- DocumentOrderQuery.cs
- EndpointDiscoveryMetadata11.cs
- DataServiceExpressionVisitor.cs
- ByteKeyFrameCollection.cs
- TrackingStringDictionary.cs
- XmlByteStreamReader.cs
- ParentQuery.cs
- FragmentNavigationEventArgs.cs
- TextEditorTables.cs
- ResXFileRef.cs
- XmlLanguage.cs
- PackagePart.cs
- codemethodreferenceexpression.cs
- SequentialActivityDesigner.cs
- HuffCodec.cs
- OrElse.cs
- HttpCacheParams.cs
- ToolStripDropDownItemDesigner.cs
- SignatureHelper.cs
- ResXResourceWriter.cs
- OleDbConnectionFactory.cs
- InlinedAggregationOperatorEnumerator.cs
- CheckBox.cs
- WindowManager.cs
- ControlsConfig.cs
- DataGridRelationshipRow.cs
- AbstractExpressions.cs
- WebPartCollection.cs
- LogicalCallContext.cs
- AnimationTimeline.cs
- ImageAutomationPeer.cs
- BindingCompleteEventArgs.cs
- ThousandthOfEmRealPoints.cs
- HiddenFieldDesigner.cs
- XmlWriter.cs
- ToolStripDropDownItem.cs
- TextBox.cs
- UnknownBitmapDecoder.cs
- CheckBoxFlatAdapter.cs
- FormsAuthenticationCredentials.cs
- NamespaceList.cs
- VisualBrush.cs
- ChannelBuilder.cs
- Console.cs
- DataGridRow.cs
- Trigger.cs
- OleDbException.cs
- ThemeInfoAttribute.cs
- DetailsViewRow.cs
- RichTextBoxAutomationPeer.cs
- ControlUtil.cs
- GestureRecognitionResult.cs
- TextServicesLoader.cs
- Executor.cs
- OperandQuery.cs
- DiffuseMaterial.cs
- MLangCodePageEncoding.cs
- CreateUserErrorEventArgs.cs
- Encoder.cs
- SqlServer2KCompatibilityAnnotation.cs
- RequiredFieldValidator.cs
- CodeNamespaceImportCollection.cs
- RouteValueDictionary.cs
- Ipv6Element.cs
- CodeCatchClause.cs
- PathGeometry.cs
- TargetConverter.cs