Esempio n. 1
0
        public void GenerateDataContextTableTypes(bool isDryRun)
        {
            var schemas = _configFile.Config.Schema
                          .Where(i => i.TableTypes?.Any() ?? false)
                          .Select(i => Definition.ForSchema(i));

            foreach (var schema in schemas)
            {
                var tableTypes = schema.TableTypes;

                var dataContextTableTypesPath = DirectoryUtils.GetWorkingDirectory(_configFile.Config.Project.Output.DataContext.Path, _configFile.Config.Project.Output.DataContext.TableTypes.Path);
                var path = Path.Combine(dataContextTableTypesPath, schema.Path);
                if (!Directory.Exists(path) && !isDryRun)
                {
                    Directory.CreateDirectory(path);
                }

                foreach (var tableType in tableTypes)
                {
                    var fileName         = $"{tableType.Name}TableType.cs";
                    var fileNameWithPath = Path.Combine(path, fileName);
                    var sourceText       = GetTableTypeText(schema, tableType);

                    _output.Write(fileNameWithPath, sourceText, isDryRun);
                }
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            ServiceSelector selector = new ServiceSelector();

            IMessageService service = selector.SelectMessageService(ConfigurationManager.AppSettings["InMemoryMessageService"]);
            var             message = service.GetMessage();

            OutputService output = selector.SelectOutput(ConfigurationManager.AppSettings["ConsoleOutput"]);

            output.Write(message);
        }