Replace CS-Script.Core To Natasha

This commit is contained in:
28810 2020-03-15 10:05:34 +08:00
parent d4bf205c79
commit 8ddf117fc7
2 changed files with 6 additions and 16 deletions

View File

@ -22,11 +22,8 @@
<None Include="../../logo.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="CS-Script.Core" Version="1.2.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="CS-Script.Core" Version="1.3.1" />
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="DotNetCore.Natasha" Version="2.12.0" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">

View File

@ -10,19 +10,12 @@ namespace FreeSql.Extensions.LazyLoading
{
#if ns20
internal static Lazy<CSScriptLib.RoslynEvaluator> _compiler = new Lazy<CSScriptLib.RoslynEvaluator>(() =>
{
var compiler = new CSScriptLib.RoslynEvaluator();
compiler.DisableReferencingFromCode = false;
compiler
.ReferenceAssemblyOf<IFreeSql>()
.ReferenceDomainAssemblies();
return compiler;
});
public static Assembly CompileCode(string cscode)
{
return _compiler.Value.CompileCode(cscode);
Natasha.AssemblyComplier complier = new Natasha.AssemblyComplier();
//complier.Domain = DomainManagment.Random;
complier.Add(cscode);
return complier.GetAssembly();
}
#else