-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
49 lines (42 loc) · 1.57 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using ClassGenerator.Generator;
using Log;
using System;
using System.Collections.Generic;
using System.Xml.Schema;
namespace ClassGenerator
{
public class Program
{
static void Main(string[] args)
{
try
{
log4net.Config.XmlConfigurator.Configure();
log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//see XsdContentReaderOptions class for more options
var opt = new XsdContentReaderOptions();
//set this options to true and see the change in generated code
opt.IsXml = false;
opt.StoreDB = false;
opt.ReadDB = false;
opt.UseAttributes = true;
opt.StoreDBPrefix = "a";
opt.CSharpNamespace = "SampleService";
opt.Files.Add(new XsdFileInfo { FileName = "sample.xsd", ShortNamespace = "Test" });
var reader = new XsdContentReader();
var content = reader.GenerateClasses(opt);
foreach (var c in content)
{
//log.Debug(c);
}
log.Debug("All done, see generated code in log or in .cs files in Debug folder");
}
catch (Exception ex)
{
log.Error(ex);
}
Console.WriteLine("\nTo many text for console?\nFull log here: bin\\Debug\\log\\ClassGenerator.log");
}
static ILog log;
}
}