mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
Recovery CSScript.Core
This commit is contained in:
parent
8ddf117fc7
commit
529be7d9d2
@ -22,9 +22,18 @@
|
|||||||
<None Include="../../logo.png" Pack="true" PackagePath="\" />
|
<None Include="../../logo.png" Pack="true" PackagePath="\" />
|
||||||
</ItemGroup>
|
</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>
|
||||||
|
|
||||||
|
<!--
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
|
||||||
<PackageReference Include="DotNetCore.Natasha" Version="2.12.0" />
|
<PackageReference Include="DotNetCore.Natasha" Version="2.12.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
-->
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
|
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
|
||||||
<DefineConstants>ns20;netstandard20</DefineConstants>
|
<DefineConstants>ns20;netstandard20</DefineConstants>
|
||||||
|
@ -10,12 +10,27 @@ namespace FreeSql.Extensions.LazyLoading
|
|||||||
{
|
{
|
||||||
|
|
||||||
#if ns20
|
#if ns20
|
||||||
|
//public static Assembly CompileCode(string cscode)
|
||||||
|
//{
|
||||||
|
// Natasha.AssemblyComplier complier = new Natasha.AssemblyComplier();
|
||||||
|
// //complier.Domain = DomainManagment.Random;
|
||||||
|
// complier.Add(cscode);
|
||||||
|
// return complier.GetAssembly();
|
||||||
|
//}
|
||||||
|
|
||||||
|
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)
|
public static Assembly CompileCode(string cscode)
|
||||||
{
|
{
|
||||||
Natasha.AssemblyComplier complier = new Natasha.AssemblyComplier();
|
return _compiler.Value.CompileCode(cscode);
|
||||||
//complier.Domain = DomainManagment.Random;
|
|
||||||
complier.Add(cscode);
|
|
||||||
return complier.GetAssembly();
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user