0

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?

loviji
  • 12,620
  • 17
  • 63
  • 94

2 Answers2

1

Point 1: I think you need at least some quotes around the connection string:

    myProcess.StartInfo.Arguments = "/mode:fullgeneration \"/c:"+cs+"\" project:School ...";

But do examine the resulting Arguments string in the debugger to see if everything is allright.

For point 2, see this SO question.

Community
  • 1
  • 1
H H
  • 263,252
  • 30
  • 330
  • 514
1

You just have to add double quotes around the connection string.

var cs = @"""Data Sour[...]rity=SSPI""";

Note the three double quotes at each end and the at.

Daniel Brückner
  • 59,031
  • 16
  • 99
  • 143