Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntityDesign / Design / System / Data / Entity / Design / AspNet / BuildProviderUtils.cs / 1305376 / BuildProviderUtils.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.CodeDom; using System.CodeDom.Compiler; using System.Globalization; using System.IO; using System.Resources; using System.Web; using System.Web.Compilation; using System.Web.Hosting; namespace System.Data.Entity.Design.AspNet { ////// A place to put common methods used by our build providers /// /// internal class BuildProviderUtils { ////// Default constructor /// private BuildProviderUtils() { } internal static void AddArtifactReference(AssemblyBuilder assemblyBuilder, BuildProvider prov, string virtualPath) { // add the artifact as a resource to the DLL using (Stream input = VirtualPathProvider.OpenFile(virtualPath)) { // derive the resource name string name = BuildProviderUtils.GetResourceNameForVirtualPath(virtualPath); using (Stream resStream = assemblyBuilder.CreateEmbeddedResource(prov, name)) { int byteRead = input.ReadByte(); while (byteRead != -1) { resStream.WriteByte((byte)byteRead); byteRead = input.ReadByte(); } } } } ////// Transforms a virtual path string into a valid resource name. /// /// ///internal static string GetResourceNameForVirtualPath(string virtualPath) { string name = VirtualPathUtility.ToAppRelative(virtualPath); Debug.Assert(name.StartsWith("~/"), "Expected app-relative path to start with ~/"); if (name.StartsWith("~/", StringComparison.OrdinalIgnoreCase)) { name = name.Substring(2); } name = name.Replace("/", "."); Debug.Assert(name.StartsWith(".") == false, "resource name unexpectedly starts with ."); return name; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.CodeDom; using System.CodeDom.Compiler; using System.Globalization; using System.IO; using System.Resources; using System.Web; using System.Web.Compilation; using System.Web.Hosting; namespace System.Data.Entity.Design.AspNet { ////// A place to put common methods used by our build providers /// /// internal class BuildProviderUtils { ////// Default constructor /// private BuildProviderUtils() { } internal static void AddArtifactReference(AssemblyBuilder assemblyBuilder, BuildProvider prov, string virtualPath) { // add the artifact as a resource to the DLL using (Stream input = VirtualPathProvider.OpenFile(virtualPath)) { // derive the resource name string name = BuildProviderUtils.GetResourceNameForVirtualPath(virtualPath); using (Stream resStream = assemblyBuilder.CreateEmbeddedResource(prov, name)) { int byteRead = input.ReadByte(); while (byteRead != -1) { resStream.WriteByte((byte)byteRead); byteRead = input.ReadByte(); } } } } ////// Transforms a virtual path string into a valid resource name. /// /// ///internal static string GetResourceNameForVirtualPath(string virtualPath) { string name = VirtualPathUtility.ToAppRelative(virtualPath); Debug.Assert(name.StartsWith("~/"), "Expected app-relative path to start with ~/"); if (name.StartsWith("~/", StringComparison.OrdinalIgnoreCase)) { name = name.Substring(2); } name = name.Replace("/", "."); Debug.Assert(name.StartsWith(".") == false, "resource name unexpectedly starts with ."); return name; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SemaphoreSecurity.cs
- Int64KeyFrameCollection.cs
- EntitySqlQueryCacheEntry.cs
- VirtualizingStackPanel.cs
- ControlIdConverter.cs
- OneWayChannelFactory.cs
- CodeNamespaceImport.cs
- EntityConnectionStringBuilderItem.cs
- HostProtectionException.cs
- _ListenerResponseStream.cs
- PopupEventArgs.cs
- WindowsTokenRoleProvider.cs
- CallTemplateAction.cs
- GridViewCommandEventArgs.cs
- BehaviorEditorPart.cs
- FontWeightConverter.cs
- ByteStorage.cs
- LookupBindingPropertiesAttribute.cs
- SymbolEqualComparer.cs
- TextCompositionEventArgs.cs
- Stroke2.cs
- WebServiceEndpoint.cs
- CodeAccessSecurityEngine.cs
- NumberAction.cs
- SiteIdentityPermission.cs
- CheckBox.cs
- MenuItemBindingCollection.cs
- WindowsAuthenticationEventArgs.cs
- PageParserFilter.cs
- RequiredAttributeAttribute.cs
- PagesSection.cs
- ValueExpressions.cs
- NativeMethods.cs
- ImageListUtils.cs
- SecurityAccessDeniedException.cs
- SingleStorage.cs
- ChangeProcessor.cs
- TextFormatterImp.cs
- EntityDescriptor.cs
- DocumentViewerHelper.cs
- TileBrush.cs
- DetailsViewDeletedEventArgs.cs
- ToolStripSystemRenderer.cs
- Brush.cs
- LineProperties.cs
- CapabilitiesUse.cs
- LabelLiteral.cs
- UniqueTransportManagerRegistration.cs
- ValidationSettings.cs
- PropertySourceInfo.cs
- WebPartUtil.cs
- ServiceContractListItem.cs
- PropertyRecord.cs
- TaiwanLunisolarCalendar.cs
- DocumentEventArgs.cs
- SerialPort.cs
- ControlPaint.cs
- SynchronousReceiveElement.cs
- LocatorPartList.cs
- DataColumnSelectionConverter.cs
- Queue.cs
- DataGrid.cs
- AxImporter.cs
- KerberosTicketHashIdentifierClause.cs
- CodeSnippetCompileUnit.cs
- WebBrowserPermission.cs
- BindValidationContext.cs
- SerializationUtility.cs
- ResXResourceReader.cs
- SqlHelper.cs
- ExpressionWriter.cs
- ControlDesigner.cs
- Monitor.cs
- BuildProvider.cs
- MemoryStream.cs
- WhitespaceRule.cs
- CompoundFileDeflateTransform.cs
- IntSecurity.cs
- TypedReference.cs
- CaseInsensitiveComparer.cs
- ApplicationManager.cs
- XmlValidatingReaderImpl.cs
- SiteMapNodeItem.cs
- UnsafeNativeMethods.cs
- XmlSerializerOperationGenerator.cs
- Point3DAnimation.cs
- XslAstAnalyzer.cs
- SplitterCancelEvent.cs
- WebControlAdapter.cs
- MonthCalendar.cs
- TextRunProperties.cs
- ValidationPropertyAttribute.cs
- MimeTypeMapper.cs
- JsonClassDataContract.cs
- TableHeaderCell.cs
- AsyncStreamReader.cs
- GridSplitterAutomationPeer.cs
- CommonProperties.cs
- DBConnectionString.cs
- SystemDropShadowChrome.cs