private static ReadOnlyCollection <AtomModel> LoadAtoms(string atomsFolder, AtomDefaults defaults) { Log.Information("Loading atoms from {AtomFolder}", atomsFolder); var atoms = AtomCreator.FromFolder(atomsFolder, defaults).ToList(); Log.Information("Loaded {LoadedAtomsCount} atoms", atoms.Count); return(atoms.AsReadOnly()); }
private IEnumerable <ProjectedAtomRoot> GetProjectionAtoms(GeneratorArguments <CSharpTargetConfig> generatorArguments, CSharpTargetConfig config) { var atoms = AtomCreator.FromFolder(generatorArguments.AtomsFolder, generatorArguments.Defaults) .ToList(); var generator = new ProjectionMemberGenerator(atoms); var projectedAtoms = generator.GetProjections(AtomCreator.ProjectionsFromFolder(generatorArguments.AtomsFolder)); return(atoms.Select(ProjectedAtomRoot.FromAtom) .Concat(projectedAtoms)); }
public void ViewGenCarePlanComplex() { var allAtoms = AtomCreator.FromFolder("TestAtoms/CareRelated/"); var projection = JsonConvert.DeserializeObject <QueryProjectionAtom>(File.ReadAllText("TestAtoms/CareRelated/CarePlan.proj.atom")); ViewGenerator generator = new ViewGenerator(projection, allAtoms: allAtoms); var refs = generator.Generate(); Console.WriteLine(string.Join(Environment.NewLine, refs.References)); Console.WriteLine(refs.Sql); }
public void CreateSqlGenerates() { var atoms = AtomCreator.FromFolder("TestAtoms/CareRelated"); foreach (var atom in atoms) { var str = SqlGenerator.CreateTable(atom); Console.WriteLine("============="); Console.WriteLine(atom.Name); Console.WriteLine("---"); Console.WriteLine(str); } }
public GeneratorResult Generate(GeneratorArguments <CSharpTargetConfig> generatorArguments) { var result = new GeneratorResult(); var allAtoms = AtomCreator.FromFolder(generatorArguments.AtomsFolder); var repositoryMembers = _sqlGenerationResults.SqlAccessors.Select(sqlAccessorMetadata => ToRepoMember(sqlAccessorMetadata, allAtoms)) .ToList(); var singleRepoGenerator = new CSharpSingleRepositoryGenerator(generatorArguments.Config); var singleRepo = singleRepoGenerator.Generate(repositoryMembers); result.AddOutput(Path.ChangeExtension(singleRepo.Name, generatorArguments.Config.FileExtension), singleRepo.CodeString); var dbFile = singleRepoGenerator.GenerateDbFile(repositoryMembers); result.AddOutput(Path.ChangeExtension(dbFile.Name, generatorArguments.Config.FileExtension), dbFile.CodeString); return(result); }