PersistenceProviderBehavior.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / ServiceModel / Description / PersistenceProviderBehavior.cs / 1305376 / PersistenceProviderBehavior.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Description
{ 
    using System;
    using System.Globalization; 
    using System.ServiceModel.Administration; 
    using System.ServiceModel.Persistence;
 
    public class PersistenceProviderBehavior : IServiceBehavior, IWmiInstanceProvider
    {
        internal static readonly TimeSpan DefaultPersistenceOperationTimeout = TimeSpan.Parse(DefaultPersistenceOperationTimeoutString, CultureInfo.InvariantCulture);
        // 30 seconds was chosen because it is the default timeout for SqlCommand 
        // (seemed like a reasonable reference point)
        internal const string DefaultPersistenceOperationTimeoutString = "00:00:30"; 
        TimeSpan persistenceOperationTimeout; 

        PersistenceProviderFactory persistenceProviderFactory; 

        public PersistenceProviderBehavior(PersistenceProviderFactory providerFactory)
            : this(providerFactory, DefaultPersistenceOperationTimeout)
        { 
            // empty
        } 
 
        public PersistenceProviderBehavior(PersistenceProviderFactory providerFactory, TimeSpan persistenceOperationTimeout)
        { 
            this.PersistenceProviderFactory = providerFactory;
            this.PersistenceOperationTimeout = persistenceOperationTimeout;
        }
 
        public TimeSpan PersistenceOperationTimeout
        { 
            get 
            {
                return this.persistenceOperationTimeout; 
            }
            set
            {
                if (value < TimeSpan.Zero) 
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( 
                        new ArgumentOutOfRangeException(SR2.GetString(SR2.PersistenceOperationTimeoutOutOfRange))); 
                }
                this.persistenceOperationTimeout = value; 
            }
        }

        public PersistenceProviderFactory PersistenceProviderFactory 
        {
            get 
            { 
                return this.persistenceProviderFactory;
            } 
            set
            {
                if (value == null)
                { 
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
                } 
                this.persistenceProviderFactory = value; 
            }
        } 


        public virtual void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        { 
            // empty
        } 
 
        public virtual void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        { 
            // empty
        }

        void IWmiInstanceProvider.FillInstance(IWmiInstance wmiInstance) 
        {
            wmiInstance.SetProperty("PersistenceOperationTimeout", this.PersistenceOperationTimeout.ToString()); 
            wmiInstance.SetProperty("PersistenceProviderFactoryType", this.PersistenceProviderFactory.GetType().FullName); 
        }
 
        string IWmiInstanceProvider.GetInstanceType()
        {
            return "PersistenceProviderBehavior";
        } 

        public virtual void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) 
        { 
            // empty
        } 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK