Skip to content

Commit f036a85

Browse files
authored
Spkl dev 191212 (#347)
* Resolves #176 * Updated dependancies to v9 * 1.0.4 Updated assembly name and added dependnacy on fakeiteasy * Added support for setting all ExecutionContext properties * Fixes #218 & SetState & SetStateDynamicEntity message property of EntityMoniker (#220) * Fixes #218 * SetState & SetStateDynamicEntity use message property of EntityMoniker * Fixes #232 * Version 1.0.6 * ix dependency load error - Cannot resolve dependency to assembly 'Sy… …stem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. site:stackoverflow.com * Fix #226: Predefined Type '' is not defined or imported (#236) Due to Visual Studio 2017 changes in how assemblies are resolved. Now project can be built using Visual Studio 2017 * Fixed typo (#280) * Fix some typos (#311) * Let OOB batch files to pass parameters like "/p" to spkl.exe * Add support for workflow base class Fix dependency load error
1 parent 9a9cc8c commit f036a85

11 files changed

+20
-14
lines changed

spkl/SparkleXrm.Tasks/PluginRegistraton.cs

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public void RegisterWorkflowActivities(string path)
5353
if (assembly == null)
5454
return;
5555

56+
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += (sender, args) => Assembly.ReflectionOnlyLoad(args.Name);
57+
5658
// Search for any types that interhit from IPlugin
5759
IEnumerable<Type> pluginTypes = Reflection.GetTypesInheritingFrom(assembly, typeof(System.Activities.CodeActivity));
5860

spkl/SparkleXrm.Tasks/Reflection.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,17 @@ public static IEnumerable<Type> GetTypesImplementingInterface(Assembly assembly,
8686

8787
public static IEnumerable<Type> GetTypesInheritingFrom(Assembly assembly, Type type)
8888
{
89-
// Load the containing assembly into the reflection context so that we can find all types deriving from System.Activities.CodeActivity
90-
System.Reflection.Assembly.ReflectionOnlyLoad(type.Assembly.FullName);
9189
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;
92-
var containingAssembly = AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies().Where(ab => ab.GetType(type.FullName) != null).First();
93-
var types = assembly.DefinedTypes.Where(p => containingAssembly.GetType(type.FullName).IsAssignableFrom(p));
90+
var definedTypes = assembly.DefinedTypes.Where(p => p.BaseType != null && p.BaseType.Name == type.Name).ToList();
91+
92+
var allTypes = new List<TypeInfo>(definedTypes);
93+
foreach (var abstractType in definedTypes.Where(t => t.IsAbstract))
94+
{
95+
var inheritingTypes = assembly.DefinedTypes.Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(abstractType.UnderlyingSystemType)).ToList();
96+
allTypes.AddRange(inheritingTypes);
97+
}
9498
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= CurrentDomain_ReflectionOnlyAssemblyResolve;
95-
return types;
99+
return allTypes;
96100
}
97101
public static IEnumerable<CustomAttributeData> GetAttributes(IEnumerable<Type> types, string attributeName)
98102
{

spkl/spkl/Package/spkl/deploy-plugins.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl plugins [path] [connection-string] [/p:release]
12-
"%spkl_path%" plugins "%cd%\.."
12+
"%spkl_path%" plugins "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/deploy-webresources.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl webresources [path] [connection-string]
12-
"%spkl_path%" webresources "%cd%\.."
12+
"%spkl_path%" webresources "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/deploy-workflows.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl workflow [path] [connection-string] [/p:release]
12-
"%spkl_path%" workflow "%cd%\.."
12+
"%spkl_path%" workflow "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/download-webresources.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl instrument [path] [connection-string] [/p:release]
12-
"%spkl_path%" download-webresources "%cd%\.." /o
12+
"%spkl_path%" download-webresources "%cd%\.." /o %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/earlybound.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl earlybound [path] [connection-string] [/p:release]
12-
"%spkl_path%" earlybound "%cd%\.."
12+
"%spkl_path%" earlybound "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/instrument-plugin-code.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl instrument [path] [connection-string] [/p:release]
12-
"%spkl_path%" instrument "%cd%\.."
12+
"%spkl_path%" instrument "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/pack+import.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl instrument [path] [connection-string] [/p:release]
12-
"%spkl_path%" import "%cd%\.."
12+
"%spkl_path%" import "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/unpack.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl instrument [path] [connection-string] [/p:release]
12-
"%spkl_path%" unpack "%cd%\.."
12+
"%spkl_path%" unpack "%cd%\.." %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

spkl/spkl/Package/spkl/unpacksolution.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For /R %package_root% %%G IN (spkl.exe) do (
99
:continue
1010
@echo Using '%spkl_path%'
1111
REM spkl instrument [path] [connection-string] [/p:release]
12-
"%spkl_path%" unpacksolution "%cd%\.." ""
12+
"%spkl_path%" unpacksolution "%cd%\.." "" %*
1313

1414
if errorlevel 1 (
1515
echo Error Code=%errorlevel%

0 commit comments

Comments
 (0)