Beispiel #1
0
        private CSharpTargetConfig GetConfig()
        {
            if (_cSharpTargetConfig != null)
            {
                return(_cSharpTargetConfig);
            }

            var targetConfig = new CSharpTargetConfig
            {
                Entities =
                {
                    Namespace   = DataNamespace,
                    OutputPath  = OutputPath,
                    StrongTypes = StrongTypes
                }
            };

            if (GenerateRepo)
            {
                targetConfig.Repository = new RepositoryTargetConfiguration
                {
                    OutputPath = RepoOutputPath ?? OutputPath,
                    Namespace  = RepoNamespace
                };
            }

            return(targetConfig);
        }
Beispiel #2
0
        public CSharpRepoGenerator(CSharpTargetConfig config)
        {
            if (config == null)
            {
                config = new CSharpTargetConfig();
            }

            _config = config;
        }
Beispiel #3
0
        public CSharpSingleRepositoryGenerator(CSharpTargetConfig config)
        {
            if (config == null)
            {
                config = new CSharpTargetConfig();
            }

            _config = config;
        }
Beispiel #4
0
        public CSharpAccessBase(CSharpTargetConfig config)
        {
            Config = config;

            if (Config == null)
            {
                Config = new CSharpTargetConfig();
            }
        }
Beispiel #5
0
        public IEnumerable <string> GetNamespaces(CSharpTargetConfig config)
        {
            var namespaces = DefaultNamespaces();

            if (config.Entities.StrongTypes)
            {
                namespaces = namespaces.Concat(StrongTypeNamespaces());
            }
            return(namespaces);
        }
Beispiel #6
0
        private IEnumerable <GeneratorResult> FromTargetConfigs(CSharpTargetConfig targetConfig)
        {
            var args = new GeneratorArguments <CSharpTargetConfig>(targetConfig, AtomsFolder, AtomCreator.LoadDefaults(AtomsFolder));

            if (targetConfig.Repository != null)
            {
                var sqlArgs      = new GeneratorArguments <SqlTargetConfig>(new SqlTargetConfig(), args.AtomsFolder, AtomCreator.LoadDefaults(AtomsFolder));
                var sqlGenerator = new SqlGenerator().Generate(sqlArgs);

                var repoResult = new RepositoryGenerator(sqlGenerator).Generate(args);

                repoResult.OutputPath = targetConfig.Repository.OutputPath;

                yield return(repoResult);
            }

            var codeResult = new CodeGenerator().Generate(args);

            codeResult.OutputPath = targetConfig.Entities.OutputPath;

            yield return(codeResult);
        }
Beispiel #7
0
 public CSharpVerb(string atomsPath, CSharpTargetConfig cSharpTargetConfig)
 {
     AtomsFolder         = atomsPath;
     _cSharpTargetConfig = cSharpTargetConfig;
 }
Beispiel #8
0
        public string ByConfig(CSharpTargetConfig config)
        {
            var namespaces = GetNamespaces(config);

            return(Header() + string.Join(Environment.NewLine, Usings(namespaces)));
        }
Beispiel #9
0
 public CSharpDapperDbAccessGenerator(CSharpTargetConfig config) : base(config)
 {
 }
 public CSharpSprocAccessGenerator(CSharpTargetConfig config)
     : base(config)
 {
 }
 public CSharpCodeClassGenerator(CSharpTargetConfig config)
     : base(config)
 {
 }