mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	Recovery CSScript.Core
This commit is contained in:
		@@ -21,10 +21,19 @@
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <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>
 | 
			
		||||
  
 | 
			
		||||
  <!--
 | 
			
		||||
  <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'">
 | 
			
		||||
    <DefineConstants>ns20;netstandard20</DefineConstants>
 | 
			
		||||
 
 | 
			
		||||
@@ -10,12 +10,27 @@ namespace FreeSql.Extensions.LazyLoading
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
#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)
 | 
			
		||||
        {
 | 
			
		||||
            Natasha.AssemblyComplier complier = new Natasha.AssemblyComplier();
 | 
			
		||||
            //complier.Domain = DomainManagment.Random;
 | 
			
		||||
            complier.Add(cscode);
 | 
			
		||||
            return complier.GetAssembly();
 | 
			
		||||
            return _compiler.Value.CompileCode(cscode);
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user