示例#1
0
 public static IPatternBuilder Resolve(PatternBuilderConfig options)
 {
     patternType = options.PatternType;
     targetLanguage = options.TargetLanguage;
     IPatternBuilder retval = ResolveBuilder();
     retval.Initialize(options);
     return retval;
 }
示例#2
0
 static void Main(string[] args)
 {
     PatternBuilderConfig config = new PatternBuilderConfig();
     config.PatternType = PatternBuilderTypeCode.Custom;
     config.TargetLanguage = PatternBuilderLanguageCode.CSharp;
     config.SaveDirectory = "C:\\test\\";
     config.ProjectName = "Email";
     config.ProjectNamespace = "Email";
     config.DBServer = ".\\SQLEXPRESS";
     config.DBInstance = "tetsuo";
     config.MethodStructures = new Dictionary<string, List<MethodStruct>>();
     config.BuilderOptions = PatternBuilderOptions.CreateVSProjFile;
     IPatternBuilder builder = PatternResolver.Resolve(config);
     builder.Execute();
 }
示例#3
0
        public static List<IPatternTemplate> Resolve(string className, PatternBuilderConfig options)
        {
            patternType = options.PatternType;
            targetLanguage = options.TargetLanguage;

            List<IPatternTemplate> templates = new List<IPatternTemplate>();

            templates.AddRange(ResolvePatternTemplates());

            // 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;
                template.TargetLanguage = options.TargetLanguage;

            });
            return templates;
        }
示例#4
0
        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);
        }