Skip to content

Bug Fixes #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spkl/SparkleXrm.Tasks/CustomAttributeDataEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ public static string GetAttributeCode(this CrmPluginRegistrationAttribute attrib
additionalParmeters += indentation + ",DeleteAsyncOperaton = " + attribute.DeleteAsyncOperaton;

if (attribute.UnSecureConfiguration != null)
additionalParmeters += indentation + ",UnSecureConfiguration = \"" + attribute.UnSecureConfiguration + "\"";
additionalParmeters += indentation + ",UnSecureConfiguration = @\"" + attribute.UnSecureConfiguration.Replace("\"","\"\"") + "\"";

if (attribute.SecureConfiguration != null)
additionalParmeters += indentation + ",SecureConfiguration = \"" + attribute.SecureConfiguration + "\"";
additionalParmeters += indentation + ",SecureConfiguration = @\"" + attribute.SecureConfiguration.Replace("\"","\"\"") + "\"";

if (attribute.Action != null)
additionalParmeters += indentation + ",Action = PluginStepOperationEnum." + attribute.Action.ToString();
Expand Down
33 changes: 22 additions & 11 deletions spkl/SparkleXrm.Tasks/PluginRegistraton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,23 +456,34 @@ private SdkMessageProcessingStepImage RegisterImage(CrmPluginRegistrationAttribu
{
return null;
}
var image = existingImages.Where(a =>
a.SdkMessageProcessingStepId.Id == step.Id
&&
a.EntityAlias == imageName
&& a.ImageType == (sdkmessageprocessingstepimage_imagetype)imagetype).FirstOrDefault();
if (image == null)
{
image = new SdkMessageProcessingStepImage();
}

var image = existingImages.FirstOrDefault(
a => a.SdkMessageProcessingStepId.Id == step.Id
&& a.EntityAlias == imageName
&& a.ImageType == (sdkmessageprocessingstepimage_imagetype)imagetype) ??
new SdkMessageProcessingStepImage();

image.Name = imageName;

image.ImageType = (sdkmessageprocessingstepimage_imagetype)imagetype;
image.SdkMessageProcessingStepId = new EntityReference(SdkMessageProcessingStep.EntityLogicalName, step.Id);
image.Attributes1 = attributes;
image.EntityAlias = imageName;
image.MessagePropertyName = stepAttribute.Message == "Create" ? "Id" : "Target";

switch (stepAttribute.Message)
{
case "Create":
image.MessagePropertyName = "Id";
break;
case "SetState":
case "SetStateDynamicEntity":
image.MessagePropertyName = "EntityMoniker";
break;
default:
image.MessagePropertyName = "Target";
break;
}

if (image.Id == Guid.Empty)
{
_trace.WriteLine("Registering Image '{0}'", image.Name);
Expand Down
1 change: 1 addition & 0 deletions spkl/SparkleXrm.Tasks/Reflection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public static IEnumerable<Type> GetTypesImplementingInterface(Assembly assembly,
{
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;
var types = assembly.DefinedTypes.Where(p => p.GetInterfaces().FirstOrDefault(a => a.Name == interfaceName.Name) != null);
Trace.WriteLine(types.FirstOrDefault()?.CustomAttributes.Count());
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= CurrentDomain_ReflectionOnlyAssemblyResolve;
return types;
}
Expand Down