public static List<IPatternTemplate> Resolve(string className, PatternBuilderConfig options) { List<IPatternTemplate> templates = new List<IPatternTemplate>(); switch (options.PatternType) { case PatternBuilderTypeCodes.Custom: templates = ResolveCustomPattern(); break; case PatternBuilderTypeCodes.Adapter: break; case PatternBuilderTypeCodes.Composite: break; case PatternBuilderTypeCodes.Factory: break; } // Now get the template generators templates.ForEach(template => { template.ClassName = className; template.NameSpace = options.ProjectNamespace; template.Methods = options.MethodStructures.ContainsKey(className) ? options.MethodStructures[className] : new List<MethodStruct>(); template.ReturnType = className; }); return templates; }
public void Exeucte(PatternBuilderConfig options) { EdmGenCommandLine cmdline = new EdmGenCommandLine(); cmdline.ContainerName = options.ContextContainerName; cmdline.DatabaseName = options.DBInstance; cmdline.DatabaseServer = options.DBServer; cmdline.NameSpace = options.ProjectNamespace; cmdline.ProjectName = options.ProjectName; // Test the call Environment.CurrentDirectory = options.SaveDirectory; ProcessStartInfo info = new ProcessStartInfo(); info.FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Microsoft.NET\framework\v4.0.30319\EdmGen.exe"; info.Arguments = cmdline.TransformText(); info.RedirectStandardOutput = true; //info.WindowStyle = ProcessWindowStyle.Hidden; info.UseShellExecute = false; //info.CreateNoWindow = true; Process.Start(info); EdmxFile edmx = ParseEdmx(cmdline); WriteEdmxFile(cmdline, edmx); WriteAppConfig(cmdline); }
public CustomPatternBuilder(PatternBuilderConfig options) { Options = options; InitializeDirectories(); }