From: JS.staff <jsp...@ec...> - 2004-02-25 11:16:11
|
That works great! I'm using little script files containing something = like: PeopleTable ; select * from "People" SomeQuery ; select name,address from "People" p inner join "Addresses" a = on p.id =3D a.person The program then uses your code to generate XSD and CS files. Any idea how to automatically add this code to the project?? Thanks, John -----Original Message----- From: Carlos Guzm=E1n =C1lvarez [mailto:car...@te...]=20 Sent: 24 February 2004 23:23 To: JS.staff Cc: fir...@li... Subject: Re: [Firebird-net-provider] Automatically creating typed = datasets Hello: > I see what you mean - no reference material anywhere for=20 > TypesDatasetGenerator! A little sample that generates a XSD and a CS file: FbConnection connection =3D new FbConnection(connectionString); DataSet employees =3D new DataSet("Employees"); FbCommand command =3D new FbCommand("select * from employee", = connection); FbDataAdapter adapter =3D new FbDataAdapter(command); = adapter.MissingSchemaAction =3D MissingSchemaAction.AddWithKey; adapter.Fill(employees, "Employees"); // Generate the employee TypedDataSet string fileName =3D @"d:\employee.cs"; StreamWriter tw =3D new StreamWriter(new FileStream(fileName, FileMode.Create, FileAccess.Write)); CodeNamespace cn =3D new CodeNamespace("employees"); CSharpCodeProvider cs =3D new CSharpCodeProvider(); ICodeGenerator cg =3D cs.CreateGenerator(); TypedDataSetGenerator.Generate(employees, cn, cg); cg.GenerateCodeFromNamespace(cn, tw, null); tw.Flush(); tw.Close(); employees.WriteXmlSchema(@"d:\employee.xsd"); connection.Close(); -- Best regards =09 Carlos Guzm=E1n =C1=81lvatrez Vigo-Spain |