Page 1 of 1

calling OracleDataSetGenerator question

Posted: Thu 06 Nov 2008 11:48
by Tatyana
I want is generate *.Designer.cs file for xsd-file of the typed dataset.

I want to do it in the run time or from the command line. NOT by "Run Custom Tool".

Do you have some kind of tool like standard .NET xsd.exe file.

Or will you please help me with generating from the code. I tried this:

class DummyProgress : CoreLab.Common.Design.IVsGeneratorProgress {
public void GeneratorError(bool isWarning, int dwLevel, string
bstrError, int dwLine, int dwColumn) {
}
public void Progress(int nComplete, int nTotal) {
}
}


private void GenerateOracleCodeFile(string inputFileName) {

CoreLab.Oracle.Design.OracleDataSetGenerator gen = new
CoreLab.Oracle.Design.OracleDataSetGenerator();
string rdr = File.ReadAllText(inputFileName);
IntPtr rgbOutputFileContents;
int pcbOutput = -1;
CoreLab.Common.Design.IVsGeneratorProgress
pGenerateProgress;
gen.Generate(inputFileName, rdr, "MyNamespace", out
rgbOutputFileContents, out pcbOutput, progress);
}

I get an error "Get CodeDomProvider Interface failed.". I tried different ways to set CodeDomProvider, but unfortunately I haven't succeeded.

Will you please help me...
________
Mercedes wiki

Posted: Thu 06 Nov 2008 14:26
by Tatyana
OracleDataSetGenerator has public method SetSite(object pUnkSite).
Will you please tell me how should it be used? What should I pass to it?
Please help me. I'm tring to figure it out....
________
Rehab community

Posted: Fri 07 Nov 2008 18:24
by Tatyana
PropertyInfo pi = gen.GetType().GetProperty("CodeProvider", BindingFlags.Instance | BindingFlags.NonPublic);
CSharpCodeProvider prov = new CSharpCodeProvider();
pi.SetValue(gen, prov, null);

gen.Generate(inputFileName, rdr, "MyNamespace", out rgbOutputFileContents, out pcbOutput, progress);
string Code = Marshal.PtrToStringAnsi(rgbOutputFileContents);

:twisted:
________
VAPORIZER REVIEW