ActivityMarkupSerializationProvider.cs source code in C# .NET

Source code for the .NET framework in C#



/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Serializer / ActivityMarkupSerializationProvider.cs / 1305376 / ActivityMarkupSerializationProvider.cs

                            namespace System.Workflow.ComponentModel.Serialization 
    using System;
    using System.ComponentModel.Design.Serialization;
    #region Class ActivityMarkupSerializationProvider
    internal sealed class ActivityMarkupSerializationProvider : WorkflowMarkupSerializationProvider 
        public override object GetSerializer(IDesignerSerializationManager manager, object currentSerializer, Type objectType, Type serializerType)
            // If this isn't a serializer type we recognize, do nothing.  Also, if metadata specified
            // a custom serializer, then use it.
            if (serializerType != typeof(WorkflowMarkupSerializer) || currentSerializer != null)
                return null; 

            if (typeof(CompositeActivity).IsAssignableFrom(objectType)) 
                return new CompositeActivityMarkupSerializer(); 

            if (typeof(ItemList<>).IsAssignableFrom(objectType)) 
                return new CollectionMarkupSerializer();

            // Ask the base class if it has a specialized serializer class for this object type.  If it returns
            // its default serializer, return our default serializer instead. 
            IDesignerSerializationProvider baseProvider = new WorkflowMarkupSerializationProvider() as IDesignerSerializationProvider;
            object baseSerializer = baseProvider.GetSerializer(manager, currentSerializer, objectType, serializerType); 
            if (baseSerializer.GetType() != typeof(WorkflowMarkupSerializer)) 
                return baseSerializer;
            return new ActivityMarkupSerializer();

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.

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