2881099 / freesql.tools Goto Github PK
View Code? Open in Web Editor NEWFreeSql 工具包,包括生成器等
License: MIT License
FreeSql 工具包,包括生成器等
License: MIT License
看起来这个文件是测试用的,可以删除或是改名标记一波?
另外想问一下,我最近想利用自定义模版功能改一个自己的模版,除了razor的用法以外,还想看看有那些基本属性和方法可以拿来使用的。
翻了一下代码,似乎只有‘FreeSql.Tools.DSkin\Models\RazorModel.cs’,但最早这个工具是dotnet tool,没有.net core版本的哇? FreeSql.Tools.DSkin
是Framework版本的
异常信息:
`
Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
b__0() in C:\Users\28810\Desktop\github\FreeSql\Extensions\FreeSql.Generator\Program.cs:line 16
at System.ConsolePal.ReadKey(Boolean intercept)
at System.Console.ReadKey()
at Colorful.Console.ReadKey()
at FreeSql.Generator.ConsoleApp..ctor(String[] args, ManualResetEvent wait) in C:\Users\28810\Desktop\github\FreeSql\Extensions\FreeSql.Generator\ConsoleApp.cs:line 331
at FreeSql.Generator.Program.<>c__DisplayClass0_0.
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
`
ExitCode: -532462766
部分代码:
`
/// <summary> /// 调用命令 /// </summary> /// <param name="cmd">命令</param> /// <param name="arguments">参数</param> /// <param name="workingDirectory">工作目录</param> /// <returns></returns> async Task<string> CallCmd(string cmd, string arguments = null, string workingDirectory = null) { using var process = GetCmdProcess(arguments, workingDirectory); process.Start(); process.StandardInput.WriteLine($"{cmd.TrimEnd('&')}&exit"); process.StandardInput.AutoFlush = true; var output = await process.StandardOutput.ReadToEndAsync(); var error = process.StandardError.ReadToEnd(); #if DEBUG Console.Write(output); Console.Write(error); #endif process.WaitForExit(); if (!error.IsNullOrWhiteSpace()) throw new ApplicationException(error); return output; } /// <summary> /// 获取进程 /// </summary> /// <param name="arguments">参数</param> /// <param name="workingDirectory">工作目录</param> /// <returns></returns> Process GetCmdProcess(string arguments, string workingDirectory = null) { var process = new Process(); process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.RedirectStandardInput = true; //process.StartInfo.StandardInputEncoding = new UTF8Encoding(true); process.StartInfo.RedirectStandardOutput = true; //process.StartInfo.StandardOutputEncoding = new UTF8Encoding(true); process.StartInfo.RedirectStandardError = true; //process.StartInfo.StandardErrorEncoding = new UTF8Encoding(true); if (Config.CurrentOS == OSPlatform.Windows) process.StartInfo.FileName = "cmd.exe"; else if (Config.CurrentOS == OSPlatform.Linux || Config.CurrentOS == OSPlatform.OSX) process.StartInfo.FileName = Environment.GetEnvironmentVariable("SHELL"); else throw new ApplicationException("不支持在当前操作系统执行此操作."); process.StartInfo.Arguments = arguments; if (!workingDirectory.IsNullOrWhiteSpace()) process.StartInfo.WorkingDirectory = workingDirectory; return process; }
`
方法调用:
`
var cmd = "FreeSql.Generator -Razor "D:\RazorTemplates\实体类+特性+导航属性(支持子父级结构).cshtml" -NameSpace "Entitys" -DB "Oracle,user id=;password=;data source=//:1521/ORCL;Pooling=true;Max Pool Size=500;" -Output "D:\Entitys.Project\Time_132805582083134656"";
await CallCmd(cmd, null, AppContext.BaseDirectory);
`
Tools下的创建任务-》数据库选择中只能看到table,没有view
FreeSql.Generator dbfirst 好像不支持 sqlserver 的 xml 类型
FreeSql.Tools.DSkin编译是提示 “在证书存储区中找不到清单签名证书”,这是加密了吗?能否提供证书文件?
数据库:
表【SysRole】的字段【ParentId】外键关联【SysRole】的【Id】(此表为树状结构(子父级));
生成的代码:
public partial class SysRole {
......
[Navigate("ParentId")]
public virtual SysRole SysRole { get; set; }
......
}
SysRole和当前类名冲突了(成员名不能与它们的封闭类型相同)。
在解决这个问题的基础上,建议新增一个特殊逻辑,当检测到树状结构时,按照FreeSql的命名规则命名导航属性,Parent,Childs;
mb.dll
不存在,通过拷贝dll.ref
文件夹下dll解决问题System.Exception:“【主库】状态不可用,等待后台检查程序恢复方可使用。无法加载 DLL“SQLite.Interop.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。”
,升级nuget最新包后解决问题。其他暂时没问题。界面很漂亮,拿来参考一下~!
.NET Core CLI 使用 firebird db 出現 Unable to load DLL 'fbembed' or one of its dependencies 信息
不知道該將 fbembed 放置於哪個目錄下 才能讓 CLI 順利運行
在使用达梦数据库时,日期字段设为了可空,但使用 FreeSql.Generator 后无法生成 datetime? 的数据类型。
bro, you done great job. But why you dont offer multi language. why this one is only in Chinese ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.