mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 NavigateAttribute 配置导航关系;
- 修复 LinqToSql 方法,开启自动迁移时,迁移了无关类的 bug; - 修复 Oracle DbFirst date(7) 类型未处理的 bug;#57 - 修复 AsSelect().Any() 未给其他条件时,产生 null bug; - 增加 FreeSql.Extensions.LazyLoading 对 .net 4.5 的支持; - 优化 MySql CodeFirst 增加 DateTime 迁移后,默认值为 0000-00-00 导致读取失败的 bug; - 优化 LazyLoading 友好错误提示;
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.CSharp;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
@ -7,6 +9,7 @@ namespace FreeSql.Extensions.LazyLoading {
|
||||
|
||||
public class LazyLoadingComplier {
|
||||
|
||||
#if ns20
|
||||
internal static Lazy<CSScriptLib.RoslynEvaluator> _compiler = new Lazy<CSScriptLib.RoslynEvaluator>(() => {
|
||||
//var dlls = Directory.GetFiles(Directory.GetParent(Type.GetType("IFreeSql, FreeSql").Assembly.Location).FullName, "*.dll");
|
||||
var compiler = new CSScriptLib.RoslynEvaluator();
|
||||
@ -26,5 +29,28 @@ namespace FreeSql.Extensions.LazyLoading {
|
||||
public static Assembly CompileCode(string cscode) {
|
||||
return _compiler.Value.CompileCode(cscode);
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
public static Assembly CompileCode(string cscode) {
|
||||
|
||||
using (var compiler = CodeDomProvider.CreateProvider("cs")) {
|
||||
|
||||
var objCompilerParameters = new CompilerParameters();
|
||||
objCompilerParameters.ReferencedAssemblies.Add("System.dll");
|
||||
objCompilerParameters.ReferencedAssemblies.Add("FreeSql.dll");
|
||||
objCompilerParameters.GenerateExecutable = false;
|
||||
objCompilerParameters.GenerateInMemory = true;
|
||||
|
||||
CompilerResults cr = compiler.CompileAssemblyFromSource(objCompilerParameters, cscode);
|
||||
|
||||
if (cr.Errors.Count > 0)
|
||||
throw new Exception(cr.Errors[0].ErrorText);
|
||||
|
||||
return cr.CompiledAssembly;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user