internal WindowsFormsCodeGeneratorStrategy(StrategyConfig config)
 {
     Writer                       = config.Writer;
     CanonicalTableName           = config.CanonicalTableName;
     Columns                      = config.Columns;
     DataAccessTech               = config.DataAccessTech;
     ValidationsEnabled           = config.ValidationsEnabled;
     ValidationColumns            = config.ValidationColumns;
     DetailValidationColumns      = config.DetailValidationColumns;
     ConnectionString             = config.ConnectionString;
     ConnectionStringWithPassword = config.ConnectionStringWithPassword;
     TableName                    = config.TableName;
     DetailTableName              = config.DetailTableName;
     CanonicalDetailTableName     = GetCanonicalIdentifier(DetailTableName);
     ConstraintName               = config.ConstraintName;
 }
Пример #2
0
        private void AddBindings(string formPath, WindowsFormsCodeGeneratorStrategy strategy)
        {
            string     originalContents = File.ReadAllText(formPath);
            FileStream fs = new FileStream(formPath, FileMode.Truncate, FileAccess.Write, FileShare.Read, 16284);

            using (StringReader sr = new StringReader(originalContents))
            {
                using (_sw = new IdentedStreamWriter(fs))
                {
                    strategy.Writer = _sw;
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        strategy.Execute(line);
                    }
                } // using StreamWriter
            }     // using StreamReader
        }