本文整理汇总了C#中System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationManager.GetService方法的典型用法代码示例。如果您正苦于以下问题:C# WorkflowMarkupSerializationManager.GetService方法的具体用法?C# WorkflowMarkupSerializationManager.GetService怎么用?C# WorkflowMarkupSerializationManager.GetService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationManager
的用法示例。
在下文中一共展示了WorkflowMarkupSerializationManager.GetService方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInstance
protected override object CreateInstance(WorkflowMarkupSerializationManager serializationManager, Type type)
{
if (serializationManager == null)
{
throw new ArgumentNullException("serializationManager");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
Connector connector = null;
IReferenceService service = serializationManager.GetService(typeof(IReferenceService)) as IReferenceService;
FreeformActivityDesigner designer = serializationManager.Context[typeof(FreeformActivityDesigner)] as FreeformActivityDesigner;
if ((designer != null) && (service != null))
{
ConnectionPoint source = null;
ConnectionPoint target = null;
try
{
Dictionary<string, string> connectorConstructionArguments = this.GetConnectorConstructionArguments(serializationManager, type);
if ((connectorConstructionArguments.ContainsKey("SourceActivity") && connectorConstructionArguments.ContainsKey("SourceConnectionIndex")) && connectorConstructionArguments.ContainsKey("SourceConnectionEdge"))
{
ActivityDesigner associatedDesigner = ActivityDesigner.GetDesigner(service.GetReference(connectorConstructionArguments["SourceActivity"]) as Activity);
DesignerEdges designerEdge = (DesignerEdges) Enum.Parse(typeof(DesignerEdges), connectorConstructionArguments["SourceConnectionEdge"]);
int connectionIndex = Convert.ToInt32(connectorConstructionArguments["SourceConnectionIndex"], CultureInfo.InvariantCulture);
if (((associatedDesigner != null) && (designerEdge != DesignerEdges.None)) && (connectionIndex >= 0))
{
source = new ConnectionPoint(associatedDesigner, designerEdge, connectionIndex);
}
}
if ((connectorConstructionArguments.ContainsKey("TargetActivity") && connectorConstructionArguments.ContainsKey("TargetConnectionIndex")) && connectorConstructionArguments.ContainsKey("TargetConnectionEdge"))
{
ActivityDesigner designer3 = ActivityDesigner.GetDesigner(service.GetReference(connectorConstructionArguments["TargetActivity"]) as Activity);
DesignerEdges edges2 = (DesignerEdges) Enum.Parse(typeof(DesignerEdges), connectorConstructionArguments["TargetConnectionEdge"]);
int num2 = Convert.ToInt32(connectorConstructionArguments["TargetConnectionIndex"], CultureInfo.InvariantCulture);
if (((designer3 != null) && (edges2 != DesignerEdges.None)) && (num2 >= 0))
{
target = new ConnectionPoint(designer3, edges2, num2);
}
}
}
catch
{
}
if ((source != null) && (target != null))
{
connector = designer.AddConnector(source, target);
}
}
return connector;
}
示例2: SerializeToString
protected internal override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
{
if (serializationManager == null)
throw new ArgumentNullException("serializationManager");
if (value == null)
throw new ArgumentNullException("value");
CodeTypeReference reference = value as CodeTypeReference;
if (reference == null)
return string.Empty;
// make the typename as best we can, and try to get the fully qualified name
// if a type is used in an assembly not referenced, GetType will complain
string typeName = ConvertTypeReferenceToString(reference);
Type type = serializationManager.GetType(typeName);
if (type == null)
{
// TypeProvider can't find it, see if it's a common type in mscorlib
type = Type.GetType(typeName, false);
if (type == null)
{
// still no luck finding it, so simply save the name without assembly information
// this is equivalent to what happened before
return typeName;
}
}
//
// If we get a real type make sure that we get the correct fully qualified name for the target framework version
string assemblyFullName = null;
TypeProvider typeProvider = serializationManager.GetService(typeof(ITypeProvider)) as TypeProvider;
if (typeProvider != null)
{
assemblyFullName = typeProvider.GetAssemblyName(type);
}
//
// If we didn't find an assembly value it is either a local type or something is wrong
// However per the general guidance on multi-targeting it is up to the caller
// to make sure that writers (such as Xoml) are given types that exist in the target framework
// This makes it the job of the rules designer or rules validator to not call the Xoml stack
// with types that do not exist in the target framework
if (string.IsNullOrEmpty(assemblyFullName))
{
typeName = type.AssemblyQualifiedName;
}
else
{
typeName = string.Format(CultureInfo.InvariantCulture, "{0}, {1}", type.FullName, assemblyFullName);
}
return typeName;
}
示例3: SerializeToString
protected internal override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
{
if (serializationManager == null)
{
throw new ArgumentNullException("serializationManager");
}
if (value == null)
{
throw new ArgumentNullException("value");
}
CodeTypeReference reference = value as CodeTypeReference;
if (reference == null)
{
return string.Empty;
}
string typeName = ConvertTypeReferenceToString(reference);
Type type = serializationManager.GetType(typeName);
if (type == null)
{
type = Type.GetType(typeName, false);
if (type == null)
{
return typeName;
}
}
string assemblyName = null;
TypeProvider service = serializationManager.GetService(typeof(ITypeProvider)) as TypeProvider;
if (service != null)
{
assemblyName = service.GetAssemblyName(type);
}
if (string.IsNullOrEmpty(assemblyName))
{
return type.AssemblyQualifiedName;
}
return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", new object[] { type.FullName, assemblyName });
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:CodeTypeReferenceSerializer.cs
示例4: CreateInstance
protected override object CreateInstance(WorkflowMarkupSerializationManager serializationManager, Type type)
{
Activity activity3;
if (serializationManager == null)
{
throw new ArgumentNullException("serializationManager");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
object obj2 = null;
IDesignerHost service = serializationManager.GetService(typeof(IDesignerHost)) as IDesignerHost;
XmlReader reader = serializationManager.WorkflowMarkupStack[typeof(XmlReader)] as XmlReader;
if ((service == null) || (reader == null))
{
return obj2;
}
string str = string.Empty;
while (reader.MoveToNextAttribute() && !reader.LocalName.Equals("Name", StringComparison.Ordinal))
{
}
if (reader.LocalName.Equals("Name", StringComparison.Ordinal) && reader.ReadAttributeValue())
{
str = reader.Value;
}
reader.MoveToElement();
if (string.IsNullOrEmpty(str))
{
serializationManager.ReportError(SR.GetString("Error_LayoutSerializationAssociatedActivityNotFound", new object[] { reader.LocalName, "Name" }));
return obj2;
}
CompositeActivityDesigner designer = serializationManager.Context[typeof(CompositeActivityDesigner)] as CompositeActivityDesigner;
if (designer != null)
{
CompositeActivity activity2 = designer.Activity as CompositeActivity;
if (activity2 == null)
{
goto Label_01D0;
}
activity3 = null;
foreach (Activity activity4 in activity2.Activities)
{
if (str.Equals(activity4.Name, StringComparison.Ordinal))
{
activity3 = activity4;
break;
}
}
}
else
{
Activity rootComponent = service.RootComponent as Activity;
if ((rootComponent != null) && !str.Equals(rootComponent.Name, StringComparison.Ordinal))
{
foreach (IComponent component in service.Container.Components)
{
rootComponent = component as Activity;
if ((rootComponent != null) && str.Equals(rootComponent.Name, StringComparison.Ordinal))
{
break;
}
}
}
if (rootComponent != null)
{
obj2 = service.GetDesigner(rootComponent);
}
goto Label_01D0;
}
if (activity3 != null)
{
obj2 = service.GetDesigner(activity3);
}
Label_01D0:
if (obj2 == null)
{
serializationManager.ReportError(SR.GetString("Error_LayoutSerializationActivityNotFound", new object[] { reader.LocalName, str, "Name" }));
}
return obj2;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:81,代码来源:ActivityDesignerLayoutSerializer.cs
示例5: GetProperties
protected internal virtual PropertyInfo[] GetProperties(WorkflowMarkupSerializationManager serializationManager, object obj)
{
if (obj == null)
throw new ArgumentNullException("obj");
if (serializationManager == null)
throw new ArgumentNullException("serializationManager");
List<PropertyInfo> properties = new List<PropertyInfo>();
object[] attributes = obj.GetType().GetCustomAttributes(typeof(RuntimeNamePropertyAttribute), true);
string name = null;
if (attributes.Length > 0)
name = (attributes[0] as RuntimeNamePropertyAttribute).Name;
foreach (PropertyInfo property in obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy))
{
DesignerSerializationVisibility visibility = Helpers.GetSerializationVisibility(property);
if (visibility == DesignerSerializationVisibility.Hidden)
continue;
if (visibility != DesignerSerializationVisibility.Content && (!property.CanWrite || property.GetSetMethod() == null))
{
// work around for CodeObject which are ICollection needs to be serialized.
if (!(obj is CodeObject) || !typeof(ICollection).IsAssignableFrom(property.PropertyType))
continue;
}
TypeProvider typeProvider = serializationManager.GetService(typeof(ITypeProvider)) as TypeProvider;
if (typeProvider != null)
{
if (!typeProvider.IsSupportedProperty(property, obj))
{
continue;
}
}
if (name == null || !name.Equals(property.Name))
properties.Add(property);
else
properties.Add(new ExtendedPropertyInfo(property, OnGetRuntimeNameValue, OnSetRuntimeNameValue, OnGetRuntimeQualifiedName));
}
return properties.ToArray();
}
示例6: InternalDeserializeFromString
private object InternalDeserializeFromString(WorkflowMarkupSerializationManager serializationManager, Type propertyType, string value)
{
if (serializationManager == null)
throw new ArgumentNullException("serializationManager");
if (propertyType == null)
throw new ArgumentNullException("propertyType");
if (value == null)
throw new ArgumentNullException("value");
object propVal = null;
XmlReader reader = serializationManager.WorkflowMarkupStack[typeof(XmlReader)] as XmlReader;
if (reader == null)
{
Debug.Assert(false, "XmlReader not available.");
return null;
}
if (IsValidCompactAttributeFormat(value))
{
propVal = DeserializeFromCompactFormat(serializationManager, reader, value);
}
else
{
if (value.StartsWith("{}", StringComparison.Ordinal))
value = value.Substring(2);
// Check for Nullable types
if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
Type genericType = (Type)propertyType.GetGenericArguments()[0];
Debug.Assert(genericType != null);
propertyType = genericType;
}
if (propertyType.IsPrimitive || propertyType == typeof(System.String))
{
propVal = Convert.ChangeType(value, propertyType, CultureInfo.InvariantCulture);
}
else if (propertyType.IsEnum)
{
propVal = Enum.Parse(propertyType, value, true);
}
else if (typeof(Delegate).IsAssignableFrom(propertyType))
{
// Just return the method name. This must happen after Bind syntax has been checked.
propVal = value;
}
else if (typeof(TimeSpan) == propertyType)
{
propVal = TimeSpan.Parse(value, CultureInfo.InvariantCulture);
}
else if (typeof(DateTime) == propertyType)
{
propVal = DateTime.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
}
else if (typeof(Guid) == propertyType)
{
propVal = Utility.CreateGuid(value);
}
else if (typeof(Type).IsAssignableFrom(propertyType))
{
propVal = serializationManager.GetType(value);
if (propVal != null)
{
Type type = propVal as Type;
if (type.IsPrimitive || type.IsEnum || type == typeof(System.String))
return type;
}
ITypeProvider typeProvider = serializationManager.GetService(typeof(ITypeProvider)) as ITypeProvider;
if (typeProvider != null)
{
Type type = typeProvider.GetType(value);
if (type != null)
return type;
}
return value;
}
else if (typeof(IConvertible).IsAssignableFrom(propertyType))
{
propVal = Convert.ChangeType(value, propertyType, CultureInfo.InvariantCulture);
}
else if (propertyType.IsAssignableFrom(value.GetType()))
{
propVal = value;
}
else
{
throw CreateSerializationError(SR.GetString(SR.Error_SerializerPrimitivePropertyNoLogic, new object[] { "", value.Trim(), "" }), reader);
}
}
return propVal;
}
示例7: GetMappingsFromXmlNamespace
internal static void GetMappingsFromXmlNamespace(WorkflowMarkupSerializationManager serializationManager, string xmlNamespace, out IList<WorkflowMarkupSerializerMapping> matchingMappings, out IList<WorkflowMarkupSerializerMapping> collectedMappings)
{
matchingMappings = new List<WorkflowMarkupSerializerMapping>();
collectedMappings = new List<WorkflowMarkupSerializerMapping>();
XmlReader reader = serializationManager.WorkflowMarkupStack[typeof(XmlReader)] as XmlReader;
if (reader != null)
{
if (xmlNamespace.StartsWith(StandardXomlKeys.CLRNamespaceQualifier, StringComparison.OrdinalIgnoreCase))
{
//Format for the xmlnamespace: clr-namespace:[Namespace][;Assembly=[AssemblyName]]
bool invalidXmlnsFormat = false;
string clrNamespace = xmlNamespace.Substring(StandardXomlKeys.CLRNamespaceQualifier.Length).Trim();
string assemblyName = String.Empty;
int index = clrNamespace.IndexOf(';');
if (index != -1)
{
assemblyName = (index + 1 < clrNamespace.Length) ? clrNamespace.Substring(index + 1).Trim() : String.Empty;
clrNamespace = clrNamespace.Substring(0, index).Trim();
if (!assemblyName.StartsWith(StandardXomlKeys.AssemblyNameQualifier, StringComparison.OrdinalIgnoreCase))
invalidXmlnsFormat = true;
assemblyName = assemblyName.Substring(StandardXomlKeys.AssemblyNameQualifier.Length);
}
if (!invalidXmlnsFormat)
{
if (clrNamespace.Equals(StandardXomlKeys.GlobalNamespace, StringComparison.OrdinalIgnoreCase))
clrNamespace = String.Empty;
matchingMappings.Add(new WorkflowMarkupSerializerMapping(reader.Prefix, xmlNamespace, clrNamespace, assemblyName));
}
}
else
{
List<Assembly> referencedAssemblies = new List<Assembly>();
if (serializationManager.LocalAssembly != null)
referencedAssemblies.Add(serializationManager.LocalAssembly);
ITypeProvider typeProvider = serializationManager.GetService(typeof(ITypeProvider)) as ITypeProvider;
if (typeProvider != null)
referencedAssemblies.AddRange(typeProvider.ReferencedAssemblies);
foreach (Assembly assembly in referencedAssemblies)
{
object[] xmlnsDefinitions = assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true);
if (xmlnsDefinitions != null)
{
foreach (XmlnsDefinitionAttribute xmlnsDefinition in xmlnsDefinitions)
{
string assemblyName = String.Empty;
if (serializationManager.LocalAssembly != assembly)
{
if (xmlnsDefinition.AssemblyName != null && xmlnsDefinition.AssemblyName.Trim().Length > 0)
assemblyName = xmlnsDefinition.AssemblyName;
else
assemblyName = assembly.FullName;
}
if (xmlnsDefinition.XmlNamespace.Equals(xmlNamespace, StringComparison.Ordinal))
matchingMappings.Add(new WorkflowMarkupSerializerMapping(reader.Prefix, xmlNamespace, xmlnsDefinition.ClrNamespace, assemblyName));
else
collectedMappings.Add(new WorkflowMarkupSerializerMapping(reader.Prefix, xmlNamespace, xmlnsDefinition.ClrNamespace, assemblyName));
}
}
}
}
}
}
示例8: GetAssemblyName
private static string GetAssemblyName(Type type, WorkflowMarkupSerializationManager manager)
{
TypeProvider typeProvider = manager.GetService(typeof(ITypeProvider)) as TypeProvider;
if (typeProvider != null)
{
return typeProvider.GetAssemblyName(type);
}
//
// Handle DesignTimeType
if (type.Assembly == null)
{
return string.Empty;
}
else
{
return type.Assembly.FullName;
}
}
示例9: CreateInstance
protected override object CreateInstance(WorkflowMarkupSerializationManager serializationManager, Type type)
{
if (serializationManager == null)
throw new ArgumentNullException("serializationManager");
if (type == null)
throw new ArgumentNullException("type");
object designer = null;
IDesignerHost host = serializationManager.GetService(typeof(IDesignerHost)) as IDesignerHost;
XmlReader reader = serializationManager.WorkflowMarkupStack[typeof(XmlReader)] as XmlReader;
if (host != null && reader != null)
{
//Find the associated activity
string associatedActivityName = String.Empty;
while (reader.MoveToNextAttribute() && !reader.LocalName.Equals("Name", StringComparison.Ordinal));
if (reader.LocalName.Equals("Name", StringComparison.Ordinal) && reader.ReadAttributeValue())
associatedActivityName = reader.Value;
reader.MoveToElement();
if (!String.IsNullOrEmpty(associatedActivityName))
{
CompositeActivityDesigner parentDesigner = serializationManager.Context[typeof(CompositeActivityDesigner)] as CompositeActivityDesigner;
if (parentDesigner == null)
{
Activity activity = host.RootComponent as Activity;
if (activity != null && !associatedActivityName.Equals(activity.Name, StringComparison.Ordinal))
{
foreach (IComponent component in host.Container.Components)
{
activity = component as Activity;
if (activity != null && associatedActivityName.Equals(activity.Name, StringComparison.Ordinal))
break;
}
}
if (activity != null)
designer = host.GetDesigner(activity);
}
else
{
CompositeActivity compositeActivity = parentDesigner.Activity as CompositeActivity;
if (compositeActivity != null)
{
Activity matchingActivity = null;
foreach (Activity activity in compositeActivity.Activities)
{
if (associatedActivityName.Equals(activity.Name, StringComparison.Ordinal))
{
matchingActivity = activity;
break;
}
}
if (matchingActivity != null)
designer = host.GetDesigner(matchingActivity);
}
}
if (designer == null)
serializationManager.ReportError(SR.GetString(SR.Error_LayoutSerializationActivityNotFound, reader.LocalName, associatedActivityName, "Name"));
}
else
{
serializationManager.ReportError(SR.GetString(SR.Error_LayoutSerializationAssociatedActivityNotFound, reader.LocalName, "Name"));
}
}
return designer;
}
示例10: CreateInstance
protected override object CreateInstance(WorkflowMarkupSerializationManager serializationManager, Type type)
{
if (serializationManager == null)
throw new ArgumentNullException("serializationManager");
if (type == null)
throw new ArgumentNullException("type");
StateDesignerConnector connector = null;
IReferenceService referenceService = serializationManager.GetService(typeof(IReferenceService)) as IReferenceService;
FreeformActivityDesigner freeformDesigner = serializationManager.Context[typeof(FreeformActivityDesigner)] as FreeformActivityDesigner;
if (freeformDesigner != null && referenceService != null)
{
StateDesigner.DesignerLayoutConnectionPoint sourceConnection = null;
ConnectionPoint targetConnection = null;
StateDesigner.TransitionInfo transitionInfo = null;
StateDesigner rootStateDesigner = null;
try
{
Dictionary<string, string> constructionArguments = GetConnectorConstructionArguments(serializationManager, type);
if (constructionArguments.ContainsKey("EventHandlerName") &&
constructionArguments.ContainsKey("SetStateName") &&
constructionArguments.ContainsKey("TargetStateName"))
{
CompositeActivity eventHandler = (CompositeActivity)referenceService.GetReference(constructionArguments["EventHandlerName"] as string);
SetStateActivity setState = (SetStateActivity)referenceService.GetReference(constructionArguments["SetStateName"] as string);
StateActivity targetState = (StateActivity)referenceService.GetReference(constructionArguments["TargetStateName"] as string);
transitionInfo = new StateDesigner.TransitionInfo(setState, eventHandler);
transitionInfo.TargetState = targetState;
}
if (constructionArguments.ContainsKey("SourceActivity") &&
constructionArguments.ContainsKey("SourceConnectionIndex") &&
constructionArguments.ContainsKey("SourceConnectionEdge") &&
constructionArguments.ContainsKey("EventHandlerName"))
{
StateDesigner sourceDesigner = (StateDesigner)StateDesigner.GetDesigner(referenceService.GetReference(constructionArguments["SourceActivity"] as string) as Activity);
CompositeActivity eventHandler = (CompositeActivity)referenceService.GetReference(constructionArguments["EventHandlerName"] as string);
rootStateDesigner = sourceDesigner.RootStateDesigner;
DesignerEdges sourceEdge = (DesignerEdges)Enum.Parse(typeof(DesignerEdges), constructionArguments["SourceConnectionEdge"] as string);
int sourceIndex = Convert.ToInt32(constructionArguments["SourceConnectionIndex"] as string, System.Globalization.CultureInfo.InvariantCulture);
if (sourceDesigner != null && eventHandler != null && sourceEdge != DesignerEdges.None && sourceIndex >= 0)
sourceConnection = new StateDesigner.DesignerLayoutConnectionPoint(sourceDesigner, sourceIndex, eventHandler, sourceEdge);
}
if (constructionArguments.ContainsKey("TargetActivity") &&
constructionArguments.ContainsKey("TargetConnectionIndex") &&
constructionArguments.ContainsKey("TargetConnectionEdge"))
{
ActivityDesigner targetDesigner = StateDesigner.GetDesigner(referenceService.GetReference(constructionArguments["TargetActivity"] as string) as Activity);
DesignerEdges targetEdge = (DesignerEdges)Enum.Parse(typeof(DesignerEdges), constructionArguments["TargetConnectionEdge"] as string);
int targetIndex = Convert.ToInt32(constructionArguments["TargetConnectionIndex"] as string, System.Globalization.CultureInfo.InvariantCulture);
if (targetDesigner != null && targetEdge != DesignerEdges.None && targetIndex >= 0)
targetConnection = new ConnectionPoint(targetDesigner, targetEdge, targetIndex);
}
}
catch
{
}
if (transitionInfo != null && sourceConnection != null && targetConnection != null)
{
connector = rootStateDesigner.FindConnector(transitionInfo);
if (connector == null)
{
rootStateDesigner.AddingSetState = false;
try
{
connector = freeformDesigner.AddConnector(sourceConnection, targetConnection) as StateDesignerConnector;
}
finally
{
rootStateDesigner.AddingSetState = true;
}
}
else
{
connector.Source = sourceConnection;
connector.Target = targetConnection;
connector.ClearConnectorSegments();
}
}
}
return connector;
}
示例11: GetMappingsFromXmlNamespace
internal static void GetMappingsFromXmlNamespace(WorkflowMarkupSerializationManager serializationManager, string xmlNamespace, out IList<WorkflowMarkupSerializerMapping> matchingMappings, out IList<WorkflowMarkupSerializerMapping> collectedMappings)
{
matchingMappings = new List<WorkflowMarkupSerializerMapping>();
collectedMappings = new List<WorkflowMarkupSerializerMapping>();
XmlReader reader = serializationManager.WorkflowMarkupStack[typeof(XmlReader)] as XmlReader;
if (reader != null)
{
if (xmlNamespace.StartsWith("clr-namespace:", StringComparison.OrdinalIgnoreCase))
{
bool flag = false;
string clrNamespace = xmlNamespace.Substring("clr-namespace:".Length).Trim();
string assemblyName = string.Empty;
int index = clrNamespace.IndexOf(';');
if (index != -1)
{
assemblyName = ((index + 1) < clrNamespace.Length) ? clrNamespace.Substring(index + 1).Trim() : string.Empty;
clrNamespace = clrNamespace.Substring(0, index).Trim();
if (!assemblyName.StartsWith("Assembly=", StringComparison.OrdinalIgnoreCase))
{
flag = true;
}
assemblyName = assemblyName.Substring("Assembly=".Length);
}
if (!flag)
{
if (clrNamespace.Equals("{Global}", StringComparison.OrdinalIgnoreCase))
{
clrNamespace = string.Empty;
}
matchingMappings.Add(new WorkflowMarkupSerializerMapping(reader.Prefix, xmlNamespace, clrNamespace, assemblyName));
}
}
else
{
List<Assembly> list = new List<Assembly>();
if (serializationManager.LocalAssembly != null)
{
list.Add(serializationManager.LocalAssembly);
}
ITypeProvider service = serializationManager.GetService(typeof(ITypeProvider)) as ITypeProvider;
if (service != null)
{
list.AddRange(service.ReferencedAssemblies);
}
foreach (Assembly assembly in list)
{
object[] customAttributes = assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true);
if (customAttributes != null)
{
foreach (XmlnsDefinitionAttribute attribute in customAttributes)
{
string fullName = string.Empty;
if (serializationManager.LocalAssembly != assembly)
{
if ((attribute.AssemblyName != null) && (attribute.AssemblyName.Trim().Length > 0))
{
fullName = attribute.AssemblyName;
}
else
{
fullName = assembly.FullName;
}
}
if (attribute.XmlNamespace.Equals(xmlNamespace, StringComparison.Ordinal))
{
matchingMappings.Add(new WorkflowMarkupSerializerMapping(reader.Prefix, xmlNamespace, attribute.ClrNamespace, fullName));
}
else
{
collectedMappings.Add(new WorkflowMarkupSerializerMapping(reader.Prefix, xmlNamespace, attribute.ClrNamespace, fullName));
}
}
}
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:77,代码来源:WorkflowMarkupSerializerMapping.cs
示例12: GetAssemblyName
private static string GetAssemblyName(Type type, WorkflowMarkupSerializationManager manager)
{
TypeProvider service = manager.GetService(typeof(ITypeProvider)) as TypeProvider;
if (service != null)
{
return service.GetAssemblyName(type);
}
if (type.Assembly == null)
{
return string.Empty;
}
return type.Assembly.FullName;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:WorkflowMarkupSerializerMapping.cs