-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
107 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ule.ElsaExtensions/Scripting/CSharp/Handlers/CSharpScriptAbpAssembliesConfigureHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using MediatR; | ||
using Passingwind.Abp.ElsaModule.Scripting.CSharp.Messages; | ||
|
||
namespace Passingwind.Abp.ElsaModule.Scripting.CSharp.Handlers; | ||
|
||
public class CSharpScriptAbpAssembliesConfigureHandler : INotificationHandler<CSharpScriptConfigureNotification> | ||
{ | ||
public Task Handle(CSharpScriptConfigureNotification notification, CancellationToken cancellationToken) | ||
{ | ||
var reference = notification.Reference; | ||
|
||
foreach (var item in Directory.GetFiles(AppContext.BaseDirectory, "Volo.*.dll")) | ||
{ | ||
reference.Assemblies.Add(Assembly.LoadFile(item)); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...Module.ElsaExtensions/Scripting/CSharp/Handlers/CSharpScriptAssembliesConfigureHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using MediatR; | ||
using Passingwind.Abp.ElsaModule.Scripting.CSharp.Messages; | ||
|
||
namespace Passingwind.Abp.ElsaModule.Scripting.CSharp.Handlers; | ||
|
||
public class CSharpScriptElsaAssembliesConfigureHandler : INotificationHandler<CSharpScriptConfigureNotification> | ||
{ | ||
public Task Handle(CSharpScriptConfigureNotification notification, CancellationToken cancellationToken) | ||
{ | ||
var reference = notification.Reference; | ||
|
||
foreach (var item in Directory.GetFiles(AppContext.BaseDirectory, "Elsa*.dll")) | ||
{ | ||
reference.Assemblies.Add(Assembly.LoadFile(item)); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...le.ElsaExtensions/Scripting/CSharp/Handlers/CSharpScriptCoreAssembliesConfigureHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Reflection; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using MediatR; | ||
using Passingwind.Abp.ElsaModule.Scripting.CSharp.Messages; | ||
|
||
namespace Passingwind.Abp.ElsaModule.Scripting.CSharp.Handlers; | ||
|
||
public class CSharpScriptCoreAssembliesConfigureHandler : INotificationHandler<CSharpScriptConfigureNotification> | ||
{ | ||
public Task Handle(CSharpScriptConfigureNotification notification, CancellationToken cancellationToken) | ||
{ | ||
var reference = notification.Reference; | ||
|
||
reference.Assemblies.Add(Assembly.Load("Microsoft.Extensions.Logging.Abstractions")); | ||
reference.Assemblies.Add(Assembly.Load("Microsoft.Extensions.Logging")); | ||
|
||
reference.Imports.Add("Microsoft.Extensions.Logging"); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Passingwind.CSharpScriptEngine; | ||
|
||
public class CSharpScriptCompileContext : CSharpScriptContext | ||
{ | ||
public CSharpScriptCompileContext(string sourceText, CSharpScriptEvaluationGlobal? evaluationGlobal = null, List<Assembly>? assemblies = null, List<string>? imports = null) : base(sourceText, evaluationGlobal, assemblies, imports) | ||
public CSharpScriptCompileContext(ILogger logger, string sourceText, CSharpScriptEvaluationGlobal? evaluationGlobal = null, List<Assembly>? assemblies = null, List<string>? imports = null) : base(logger, sourceText, evaluationGlobal, assemblies, imports) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 10 additions & 5 deletions
15
src/Passingwind.CSharpScript/CSharpScriptEvaluationGlobal.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters