通过System.Diagnostics.Process生成EF模型
阅读这篇文章后,我尝试通过 System.Diagnostics 生成 EF 模型。过程:
Process myProcess = new Process();
var cs = "Data Source=.\\SQLEXPRESS; Initial Catalog=uqs; Integrated Security=SSPI";
myProcess.StartInfo.FileName = @"C:\Windows\Microsoft.NET\Framework\v3.5\EdmGen.exe";
myProcess.StartInfo.Arguments = "/mode:fullgeneration /c:"+cs+" project:School /entitycontainer:SchoolEntities /namespace:SchoolModel /language:CSharp ";
myProcess.Start();
但我还没有得到结果,因为我不能做格式良好的参数字符串。当我尝试时,有很多引用。如何组织参数字符串?
after read this article i tried generate EF model by System.Diagnostics.Process:
Process myProcess = new Process();
var cs = "Data Source=.\\SQLEXPRESS; Initial Catalog=uqs; Integrated Security=SSPI";
myProcess.StartInfo.FileName = @"C:\Windows\Microsoft.NET\Framework\v3.5\EdmGen.exe";
myProcess.StartInfo.Arguments = "/mode:fullgeneration /c:"+cs+" project:School /entitycontainer:SchoolEntities /namespace:SchoolModel /language:CSharp ";
myProcess.Start();
but i haven't get a result, because i can't do well formed arguments string. As I tried, there have many quotes. how to organize argument string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需在连接字符串周围添加双引号即可。
请注意两端的三个双引号和 at。
You just have to add double quotes around the connection string.
Note the three double quotes at each end and the at.
第 1 点:我认为您至少需要在连接字符串周围加上一些引号:
但是请检查调试器中生成的参数字符串,看看一切是否正常。
对于第 2 点,请参阅这个问题。
Point 1: I think you need at least some quotes around the connection string:
But do examine the resulting Arguments string in the debugger to see if everything is allright.
For point 2, see this SO question.