private string ResolveTransformName(XDocument document) { Guard.ArgumentNotNull(document, "document"); // Create a Rules Engine fact representing the message type of the item being processed. MessageTypeFact msgTypeFact = new MessageTypeFact(document); // Construct a cache key that uniquely identifies a specific cache item based on the input document type. string cacheKeyName = String.Concat(this.GetType().FullName, "_ResolveTransform_", msgTypeFact.Value); return(this.cacheProviderExtension.GetOrPut(cacheKeyName, () => { // Invoke a policy to determine the name of the map to be applied to the item being processed. StringDictionaryFact policyExecutionResult = this.rulesEngineExtension.ExecutePolicy <StringDictionaryFact>(this.configSettingsExtension.Settings.HandlingPolicyName, msgTypeFact); if (policyExecutionResult != null && policyExecutionResult.Items != null && policyExecutionResult.Items.Count > 0) { // Take a dictionary item by it's predefined name. return policyExecutionResult.Items[Resources.StringDictionaryFactValueTransformName]; } else { return null; } }) as string); }
private Type ResolveDataTransferObjectType(XDocument document) { Guard.ArgumentNotNull(document, "document"); // Create a Rules Engine fact representing the message type of the item being processed. MessageTypeFact msgTypeFact = new MessageTypeFact(document); // Construct a cache key that uniquely identifies a specific cache item based on the input document type. string cacheKeyName = String.Concat(this.GetType().FullName, "_ResolveDTOTypeName_", msgTypeFact.Value); string dtoTypeName = this.cacheProviderExtension.GetOrPut(cacheKeyName, () => { // Invoke a policy to determine the name of the map to be applied to the item being processed. StringDictionaryFact policyExecutionResult = this.rulesEngineExtension.ExecutePolicy <StringDictionaryFact>(this.configSettingsExtension.Settings.HandlingPolicyName, msgTypeFact); if (policyExecutionResult != null && policyExecutionResult.Items != null && policyExecutionResult.Items.Count > 0) { // Take a dictionary item by it's predefined name. return(policyExecutionResult.Items[Resources.StringDictionaryFactValueDataTransferObjectType]); } else { return(null); } }) as string; if (!String.IsNullOrEmpty(dtoTypeName)) { // Construct a cache key that uniquely identifies a specific cache item based on the input document type. cacheKeyName = String.Concat(this.GetType().FullName, "_ResolveDTOType_", dtoTypeName); return(this.cacheProviderExtension.GetOrPut(cacheKeyName, () => { // First, assume that we have a fully-qualified type name. Type dtoType = Type.GetType(dtoTypeName, false); if (dtoType != null) { return dtoType; } // Not a fully qualified type name, assume we have a type name with namespace, try to append the assembly name. string fullTypeName = DefaultDtoAssemblyQualifiedName.Replace(DefaultDtoTypeFullName, dtoTypeName); dtoType = Type.GetType(fullTypeName, false); if (dtoType != null) { return dtoType; } // Still not found, assume we have just a type name, append both the namespace and assembly name. fullTypeName = DefaultDtoAssemblyQualifiedName.Replace(DefaultDtoTypeFullName, String.Concat(DefaultDtoNamespace, ".", dtoTypeName)); dtoType = Type.GetType(fullTypeName, false); return dtoType; }) as Type); } else { return(null); } }