- 增加 延时属性编译错误信息;
- 优化 FreeSql.Repository Autofac 泛型注入;
This commit is contained in:
2881099
2019-03-10 21:23:06 +08:00
parent 428220e754
commit ec2fcfb419
11 changed files with 277 additions and 87 deletions

View File

@ -449,8 +449,13 @@ namespace FreeSql.Internal {
}
if (overrieds > 0) {
cscode.AppendLine("}");
var assemly = Generator.TemplateEngin._compiler.Value.CompileCode(cscode.ToString());
var type = assemly.DefinedTypes.Where(a => a.FullName.EndsWith(trytbTypeLazyName)).FirstOrDefault();
Assembly assembly = null;
try {
assembly = Generator.TemplateEngin._compiler.Value.CompileCode(cscode.ToString());
} catch (Exception ex) {
throw new Exception($"【延时加载】{trytbTypeName} 编译错误:{ex.Message}\r\n\r\n{cscode}");
}
var type = assembly.DefinedTypes.Where(a => a.FullName.EndsWith(trytbTypeLazyName)).FirstOrDefault();
trytb.TypeLazy = type;
trytb.TypeLazySetOrm = type.GetProperty("__fsql_orm__", BindingFlags.Instance | BindingFlags.NonPublic).GetSetMethod(true);
}