Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Messaging / System / Messaging / DefaultPropertiesToSend.cs / 1305376 / DefaultPropertiesToSend.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Messaging { using System.Diagnostics; using System; using System.ComponentModel; ////// /// [TypeConverter(typeof(ExpandableObjectConverter))] public class DefaultPropertiesToSend { private Message cachedMessage = new Message(); private bool designMode; private MessageQueue cachedAdminQueue; private MessageQueue cachedResponseQueue; private MessageQueue cachedTransactionStatusQueue; ////// Specifies the default property values that will be used when /// sending objects using the message queue. /// ////// /// public DefaultPropertiesToSend() { } ////// Initializes a new instance of the ////// class. /// /// internal DefaultPropertiesToSend(bool designMode) { this.designMode = designMode; } /// /// /// [DefaultValueAttribute(AcknowledgeTypes.None), MessagingDescription(Res.MsgAcknowledgeType)] public AcknowledgeTypes AcknowledgeType { get { return this.cachedMessage.AcknowledgeType; } set { this.cachedMessage.AcknowledgeType = value; } } ////// Gets /// or sets the type of acknowledgement message to be returned to the sending /// application. /// ////// /// [DefaultValueAttribute(null), MessagingDescription(Res.MsgAdministrationQueue)] public MessageQueue AdministrationQueue { get { if (this.designMode) { if (this.cachedAdminQueue != null && this.cachedAdminQueue.Site == null) this.cachedAdminQueue = null; return this.cachedAdminQueue; } return this.cachedMessage.AdministrationQueue; } set { //The format name of this queue shouldn't be //resolved at desgin time, but it should at runtime. if (this.designMode) this.cachedAdminQueue = value; else this.cachedMessage.AdministrationQueue = value; } } ////// Gets or sets the queue used for acknowledgement messages /// generated by the application. This is the queue that /// will receive the acknowledgment message for the message you are about to /// send. /// ////// /// [DefaultValueAttribute(0), MessagingDescription(Res.MsgAppSpecific)] public int AppSpecific { get { return this.cachedMessage.AppSpecific; } set { this.cachedMessage.AppSpecific = value; } } ////// Gets or sets application-generated information. /// /// ////// /// [DefaultValueAttribute(true), MessagingDescription(Res.MsgAttachSenderId)] public bool AttachSenderId { get { return this.cachedMessage.AttachSenderId; } set { this.cachedMessage.AttachSenderId = value; } } ////// Gets or sets a value indicating if the sender ID is to be attached to the /// message. /// /// ////// internal Message CachedMessage { get { return this.cachedMessage; } } /// /// /// [DefaultValueAttribute(EncryptionAlgorithm.Rc2), MessagingDescription(Res.MsgEncryptionAlgorithm)] public EncryptionAlgorithm EncryptionAlgorithm { get { return this.cachedMessage.EncryptionAlgorithm; } set { this.cachedMessage.EncryptionAlgorithm = value; } } ////// Gets or sets the encryption algorithm used to encrypt the body of a /// private message. /// /// ////// /// [ Editor("System.ComponentModel.Design.ArrayEditor, " + AssemblyRef.SystemDesign, "System.Drawing.Design.UITypeEditor, " + AssemblyRef.SystemDrawing), MessagingDescription(Res.MsgExtension) ] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public byte[] Extension { get { return this.cachedMessage.Extension; } set { this.cachedMessage.Extension = value; } } ////// Gets or sets additional information associated with the message. /// /// ////// /// [DefaultValueAttribute(HashAlgorithm.Md5), MessagingDescription(Res.MsgHashAlgorithm)] public HashAlgorithm HashAlgorithm { get { return this.cachedMessage.HashAlgorithm; } set { this.cachedMessage.HashAlgorithm = value; } } ////// Gets or sets the hashing algorithm used when /// authenticating /// messages. /// /// ////// /// [DefaultValueAttribute(""), MessagingDescription(Res.MsgLabel)] public string Label { get { return this.cachedMessage.Label; } set { this.cachedMessage.Label = value; } } ////// Gets or sets the message label. /// /// ////// /// [DefaultValueAttribute(MessagePriority.Normal), MessagingDescription(Res.MsgPriority)] public MessagePriority Priority { get { return this.cachedMessage.Priority; } set { this.cachedMessage.Priority = value; } } ////// Gets or sets the message priority. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgRecoverable)] public bool Recoverable { get { return this.cachedMessage.Recoverable; } set { this.cachedMessage.Recoverable = value; } } ////// Gets or sets a value indicating whether the message is /// guaranteed to be delivered in the event /// of a computer failure or network problem. /// /// ////// /// [DefaultValueAttribute(null), MessagingDescription(Res.MsgResponseQueue)] public MessageQueue ResponseQueue { get { if (this.designMode) return this.cachedResponseQueue; return this.cachedMessage.ResponseQueue; } set { //The format name of this queue shouldn't be //resolved at desgin time, but it should at runtime. if (this.designMode) this.cachedResponseQueue = value; else this.cachedMessage.ResponseQueue = value; } } ////// Gets or sets the queue which receives application-generated response /// messages. /// /// ////// /// [ TypeConverter(typeof(System.Messaging.Design.TimeoutConverter)), MessagingDescription(Res.MsgTimeToBeReceived) ] public TimeSpan TimeToBeReceived { get { return this.cachedMessage.TimeToBeReceived; } set { this.cachedMessage.TimeToBeReceived = value; } } ////// Gets or sets the time limit for the message to be /// retrieved from /// the target queue. /// ////// /// [ TypeConverter(typeof(System.Messaging.Design.TimeoutConverter)), MessagingDescription(Res.MsgTimeToReachQueue) ] public TimeSpan TimeToReachQueue { get { return this.cachedMessage.TimeToReachQueue; } set { this.cachedMessage.TimeToReachQueue = value; } } ////// Gets or sets the time limit for the message to /// reach the queue. /// /// ////// /// [DefaultValueAttribute(null), MessagingDescription(Res.MsgTransactionStatusQueue)] public MessageQueue TransactionStatusQueue { get { if (this.designMode) return this.cachedTransactionStatusQueue; return this.cachedMessage.TransactionStatusQueue; } set { //The format name of this queue shouldn't be //resolved at desgin time, but it should at runtime. if (this.designMode) this.cachedTransactionStatusQueue = value; else this.cachedMessage.TransactionStatusQueue = value; } } ////// Gets the transaction status queue on the source computer. /// /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseAuthentication)] public bool UseAuthentication { get { return this.cachedMessage.UseAuthentication; } set { this.cachedMessage.UseAuthentication = value; } } ////// Gets or sets a value indicating whether the message must be authenticated. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseDeadLetterQueue)] public bool UseDeadLetterQueue { get { return this.cachedMessage.UseDeadLetterQueue; } set { this.cachedMessage.UseDeadLetterQueue = value; } } ////// Gets or sets a value indicating whether a copy of the message that could not /// be delivered should be sent to a dead-letter queue. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseEncryption)] public bool UseEncryption { get { return this.cachedMessage.UseEncryption; } set { this.cachedMessage.UseEncryption = value; } } ////// Gets or sets a value indicating whether to encrypt private messages. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseJournalQueue)] public bool UseJournalQueue { get { return this.cachedMessage.UseJournalQueue; } set { this.cachedMessage.UseJournalQueue = value; } } ////// Gets or sets a value indicating whether a copy of the message should be kept /// in a machine journal on the originating computer. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseTracing)] public bool UseTracing { get { return this.cachedMessage.UseTracing; } set { this.cachedMessage.UseTracing = value; } } ////// Gets or sets a value indicating whether to trace a message as it moves toward /// its destination queue. /// ////// private bool ShouldSerializeTimeToBeReceived() { if (TimeToBeReceived == Message.InfiniteTimeout) return false; return true; } /// /// private bool ShouldSerializeTimeToReachQueue() { if (TimeToReachQueue == Message.InfiniteTimeout) return false; return true; } /// /// private bool ShouldSerializeExtension() { if (Extension != null && Extension.Length > 0) { return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Messaging { using System.Diagnostics; using System; using System.ComponentModel; ////// /// [TypeConverter(typeof(ExpandableObjectConverter))] public class DefaultPropertiesToSend { private Message cachedMessage = new Message(); private bool designMode; private MessageQueue cachedAdminQueue; private MessageQueue cachedResponseQueue; private MessageQueue cachedTransactionStatusQueue; ////// Specifies the default property values that will be used when /// sending objects using the message queue. /// ////// /// public DefaultPropertiesToSend() { } ////// Initializes a new instance of the ////// class. /// /// internal DefaultPropertiesToSend(bool designMode) { this.designMode = designMode; } /// /// /// [DefaultValueAttribute(AcknowledgeTypes.None), MessagingDescription(Res.MsgAcknowledgeType)] public AcknowledgeTypes AcknowledgeType { get { return this.cachedMessage.AcknowledgeType; } set { this.cachedMessage.AcknowledgeType = value; } } ////// Gets /// or sets the type of acknowledgement message to be returned to the sending /// application. /// ////// /// [DefaultValueAttribute(null), MessagingDescription(Res.MsgAdministrationQueue)] public MessageQueue AdministrationQueue { get { if (this.designMode) { if (this.cachedAdminQueue != null && this.cachedAdminQueue.Site == null) this.cachedAdminQueue = null; return this.cachedAdminQueue; } return this.cachedMessage.AdministrationQueue; } set { //The format name of this queue shouldn't be //resolved at desgin time, but it should at runtime. if (this.designMode) this.cachedAdminQueue = value; else this.cachedMessage.AdministrationQueue = value; } } ////// Gets or sets the queue used for acknowledgement messages /// generated by the application. This is the queue that /// will receive the acknowledgment message for the message you are about to /// send. /// ////// /// [DefaultValueAttribute(0), MessagingDescription(Res.MsgAppSpecific)] public int AppSpecific { get { return this.cachedMessage.AppSpecific; } set { this.cachedMessage.AppSpecific = value; } } ////// Gets or sets application-generated information. /// /// ////// /// [DefaultValueAttribute(true), MessagingDescription(Res.MsgAttachSenderId)] public bool AttachSenderId { get { return this.cachedMessage.AttachSenderId; } set { this.cachedMessage.AttachSenderId = value; } } ////// Gets or sets a value indicating if the sender ID is to be attached to the /// message. /// /// ////// internal Message CachedMessage { get { return this.cachedMessage; } } /// /// /// [DefaultValueAttribute(EncryptionAlgorithm.Rc2), MessagingDescription(Res.MsgEncryptionAlgorithm)] public EncryptionAlgorithm EncryptionAlgorithm { get { return this.cachedMessage.EncryptionAlgorithm; } set { this.cachedMessage.EncryptionAlgorithm = value; } } ////// Gets or sets the encryption algorithm used to encrypt the body of a /// private message. /// /// ////// /// [ Editor("System.ComponentModel.Design.ArrayEditor, " + AssemblyRef.SystemDesign, "System.Drawing.Design.UITypeEditor, " + AssemblyRef.SystemDrawing), MessagingDescription(Res.MsgExtension) ] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public byte[] Extension { get { return this.cachedMessage.Extension; } set { this.cachedMessage.Extension = value; } } ////// Gets or sets additional information associated with the message. /// /// ////// /// [DefaultValueAttribute(HashAlgorithm.Md5), MessagingDescription(Res.MsgHashAlgorithm)] public HashAlgorithm HashAlgorithm { get { return this.cachedMessage.HashAlgorithm; } set { this.cachedMessage.HashAlgorithm = value; } } ////// Gets or sets the hashing algorithm used when /// authenticating /// messages. /// /// ////// /// [DefaultValueAttribute(""), MessagingDescription(Res.MsgLabel)] public string Label { get { return this.cachedMessage.Label; } set { this.cachedMessage.Label = value; } } ////// Gets or sets the message label. /// /// ////// /// [DefaultValueAttribute(MessagePriority.Normal), MessagingDescription(Res.MsgPriority)] public MessagePriority Priority { get { return this.cachedMessage.Priority; } set { this.cachedMessage.Priority = value; } } ////// Gets or sets the message priority. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgRecoverable)] public bool Recoverable { get { return this.cachedMessage.Recoverable; } set { this.cachedMessage.Recoverable = value; } } ////// Gets or sets a value indicating whether the message is /// guaranteed to be delivered in the event /// of a computer failure or network problem. /// /// ////// /// [DefaultValueAttribute(null), MessagingDescription(Res.MsgResponseQueue)] public MessageQueue ResponseQueue { get { if (this.designMode) return this.cachedResponseQueue; return this.cachedMessage.ResponseQueue; } set { //The format name of this queue shouldn't be //resolved at desgin time, but it should at runtime. if (this.designMode) this.cachedResponseQueue = value; else this.cachedMessage.ResponseQueue = value; } } ////// Gets or sets the queue which receives application-generated response /// messages. /// /// ////// /// [ TypeConverter(typeof(System.Messaging.Design.TimeoutConverter)), MessagingDescription(Res.MsgTimeToBeReceived) ] public TimeSpan TimeToBeReceived { get { return this.cachedMessage.TimeToBeReceived; } set { this.cachedMessage.TimeToBeReceived = value; } } ////// Gets or sets the time limit for the message to be /// retrieved from /// the target queue. /// ////// /// [ TypeConverter(typeof(System.Messaging.Design.TimeoutConverter)), MessagingDescription(Res.MsgTimeToReachQueue) ] public TimeSpan TimeToReachQueue { get { return this.cachedMessage.TimeToReachQueue; } set { this.cachedMessage.TimeToReachQueue = value; } } ////// Gets or sets the time limit for the message to /// reach the queue. /// /// ////// /// [DefaultValueAttribute(null), MessagingDescription(Res.MsgTransactionStatusQueue)] public MessageQueue TransactionStatusQueue { get { if (this.designMode) return this.cachedTransactionStatusQueue; return this.cachedMessage.TransactionStatusQueue; } set { //The format name of this queue shouldn't be //resolved at desgin time, but it should at runtime. if (this.designMode) this.cachedTransactionStatusQueue = value; else this.cachedMessage.TransactionStatusQueue = value; } } ////// Gets the transaction status queue on the source computer. /// /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseAuthentication)] public bool UseAuthentication { get { return this.cachedMessage.UseAuthentication; } set { this.cachedMessage.UseAuthentication = value; } } ////// Gets or sets a value indicating whether the message must be authenticated. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseDeadLetterQueue)] public bool UseDeadLetterQueue { get { return this.cachedMessage.UseDeadLetterQueue; } set { this.cachedMessage.UseDeadLetterQueue = value; } } ////// Gets or sets a value indicating whether a copy of the message that could not /// be delivered should be sent to a dead-letter queue. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseEncryption)] public bool UseEncryption { get { return this.cachedMessage.UseEncryption; } set { this.cachedMessage.UseEncryption = value; } } ////// Gets or sets a value indicating whether to encrypt private messages. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseJournalQueue)] public bool UseJournalQueue { get { return this.cachedMessage.UseJournalQueue; } set { this.cachedMessage.UseJournalQueue = value; } } ////// Gets or sets a value indicating whether a copy of the message should be kept /// in a machine journal on the originating computer. /// ////// /// [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseTracing)] public bool UseTracing { get { return this.cachedMessage.UseTracing; } set { this.cachedMessage.UseTracing = value; } } ////// Gets or sets a value indicating whether to trace a message as it moves toward /// its destination queue. /// ////// private bool ShouldSerializeTimeToBeReceived() { if (TimeToBeReceived == Message.InfiniteTimeout) return false; return true; } /// /// private bool ShouldSerializeTimeToReachQueue() { if (TimeToReachQueue == Message.InfiniteTimeout) return false; return true; } /// /// private bool ShouldSerializeExtension() { if (Extension != null && Extension.Length > 0) { return true; } return false; } } } // 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
- OdbcConnectionFactory.cs
- StrongBox.cs
- WindowsAuthenticationEventArgs.cs
- Section.cs
- FigureParagraph.cs
- DateTimeFormatInfoScanner.cs
- HttpListenerElement.cs
- FontDifferentiator.cs
- SocketPermission.cs
- InkPresenterAutomationPeer.cs
- MulticastDelegate.cs
- GridViewDeletedEventArgs.cs
- BrowserTree.cs
- SymbolResolver.cs
- DecimalAnimationUsingKeyFrames.cs
- HTTPNotFoundHandler.cs
- PageAdapter.cs
- MergePropertyDescriptor.cs
- OperationCanceledException.cs
- ViewSimplifier.cs
- ActivationWorker.cs
- BitmapEffectrendercontext.cs
- TextEffect.cs
- _NestedMultipleAsyncResult.cs
- cookie.cs
- WebReferencesBuildProvider.cs
- AssemblyUtil.cs
- SelectionBorderGlyph.cs
- TextEditorThreadLocalStore.cs
- ListViewUpdatedEventArgs.cs
- MediaEntryAttribute.cs
- AnnotationStore.cs
- ComponentEvent.cs
- CompoundFileStorageReference.cs
- SizeKeyFrameCollection.cs
- List.cs
- HTTPRemotingHandler.cs
- AliasExpr.cs
- TextViewBase.cs
- RestClientProxyHandler.cs
- AnnotationStore.cs
- COM2FontConverter.cs
- AssemblyBuilder.cs
- CaseInsensitiveComparer.cs
- recordstatescratchpad.cs
- SectionUpdates.cs
- BrowsableAttribute.cs
- Point4DValueSerializer.cs
- HtmlInputButton.cs
- LineInfo.cs
- HttpDigestClientCredential.cs
- Int16KeyFrameCollection.cs
- XmlArrayItemAttribute.cs
- OledbConnectionStringbuilder.cs
- XmlSchemaSimpleTypeUnion.cs
- ValueChangedEventManager.cs
- PanelDesigner.cs
- RuntimeConfigLKG.cs
- HealthMonitoringSection.cs
- SamlDelegatingWriter.cs
- ListViewItem.cs
- WebPartDescriptionCollection.cs
- CoordinationService.cs
- KerberosSecurityTokenAuthenticator.cs
- OleDbDataReader.cs
- ProbeDuplexAsyncResult.cs
- XmlSecureResolver.cs
- XmlQueryOutput.cs
- ByteStack.cs
- LogicalExpr.cs
- PriorityBindingExpression.cs
- ThreadAbortException.cs
- PerformanceCounter.cs
- ComAdminInterfaces.cs
- EndOfStreamException.cs
- ApplicationDirectoryMembershipCondition.cs
- IisTraceWebEventProvider.cs
- WindowsSolidBrush.cs
- SqlStatistics.cs
- DoubleAnimationUsingPath.cs
- WebPartPersonalization.cs
- Pool.cs
- MarkupExtensionParser.cs
- RelationshipDetailsRow.cs
- ControlCachePolicy.cs
- XPathException.cs
- Int32.cs
- ParsedAttributeCollection.cs
- NamespaceInfo.cs
- unitconverter.cs
- SurrogateEncoder.cs
- ContextMenu.cs
- X509Certificate.cs
- BrowserDefinitionCollection.cs
- TagMapCollection.cs
- HttpRuntimeSection.cs
- EdmFunctions.cs
- IsolatedStorageFileStream.cs
- BindingContext.cs
- HyperLinkDataBindingHandler.cs