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
- TraceSwitch.cs
- RootBuilder.cs
- IconConverter.cs
- LexicalChunk.cs
- JoinSymbol.cs
- DataGridTable.cs
- WebPartConnection.cs
- IOThreadTimer.cs
- ResourceIDHelper.cs
- WebEncodingValidator.cs
- TdsValueSetter.cs
- ChtmlTextBoxAdapter.cs
- CngKeyBlobFormat.cs
- X509Certificate2Collection.cs
- DebugView.cs
- SourceFileBuildProvider.cs
- SelectionWordBreaker.cs
- OneToOneMappingSerializer.cs
- InstanceView.cs
- Latin1Encoding.cs
- DynamicScriptObject.cs
- CompositeFontParser.cs
- RecognizerStateChangedEventArgs.cs
- TypeConverters.cs
- SessionSwitchEventArgs.cs
- DbReferenceCollection.cs
- GridLengthConverter.cs
- ComplexType.cs
- BaseUriHelper.cs
- CodeDelegateInvokeExpression.cs
- HtmlTable.cs
- MeasurementDCInfo.cs
- UniqueConstraint.cs
- LayoutEvent.cs
- DataTableNewRowEvent.cs
- ChildTable.cs
- PageTrueTypeFont.cs
- DataRowView.cs
- OleDbRowUpdatedEvent.cs
- WindowsSysHeader.cs
- CodeActivity.cs
- TopClause.cs
- PropertyGeneratedEventArgs.cs
- QilReplaceVisitor.cs
- WindowsGraphics2.cs
- Ipv6Element.cs
- GB18030Encoding.cs
- DesignerHierarchicalDataSourceView.cs
- oledbmetadatacollectionnames.cs
- WebBrowsableAttribute.cs
- StrongNameKeyPair.cs
- SqlDataSourceQueryEditorForm.cs
- PageContentCollection.cs
- ImmutableCollection.cs
- Rfc2898DeriveBytes.cs
- _FixedSizeReader.cs
- OutOfMemoryException.cs
- DoubleLinkListEnumerator.cs
- BaseResourcesBuildProvider.cs
- SelectedDatesCollection.cs
- Pkcs9Attribute.cs
- FixedSOMLineRanges.cs
- MeasureItemEvent.cs
- XmlSchemaSet.cs
- WebServiceData.cs
- TableCell.cs
- ReferentialConstraint.cs
- HttpValueCollection.cs
- DeviceContexts.cs
- LogReserveAndAppendState.cs
- Size.cs
- ApplicationContext.cs
- EntityDataSourceViewSchema.cs
- Rotation3DAnimationBase.cs
- BuildResultCache.cs
- QueryOutputWriter.cs
- SizeFConverter.cs
- HtmlMeta.cs
- ConstructorExpr.cs
- IImplicitResourceProvider.cs
- RectValueSerializer.cs
- CompilerParameters.cs
- ComEventsHelper.cs
- Command.cs
- HtmlUtf8RawTextWriter.cs
- CodePrimitiveExpression.cs
- ClassData.cs
- DBPropSet.cs
- DocumentViewerBase.cs
- WebUtil.cs
- UnsafeNativeMethodsCLR.cs
- MenuRenderer.cs
- EntityContainer.cs
- CoreSwitches.cs
- _RegBlobWebProxyDataBuilder.cs
- MimeMultiPart.cs
- CompareInfo.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- FileEnumerator.cs
- SQLUtility.cs