Пример #1
0
        public static String Get(JsonSchema4 schema, String ns, bool generated)
        {
            String Model, model;

            NameGenerator.CreatePascalAndCamel(schema.Title, out Model, out model);
            String Models, models;

            NameGenerator.CreatePascalAndCamel(schema.GetPluralName(), out Models, out models);

            String inputToEntityEqualAssertFunc = "";
            String entityToViewEqualAssertFunc  = "";
            String createInputFunc  = "";
            String createEntityFunc = "";
            String createViewFunc   = "";

            if (!generated)
            {
                ModelTestWrapperGenerated.GetTestHelpers(schema, ns, out inputToEntityEqualAssertFunc, out entityToViewEqualAssertFunc, out createInputFunc, out createEntityFunc, out createViewFunc);
            }

            var repoMockup = "";

            if (schema.CreateRepository())
            {
                repoMockup = $"mockup.Add<I{Model}Repository>(m => new {Model}Repository(m.Get<AppDbContext>(), m.Get<AppMapper>()));";
            }

            return(Create(ns, Model, model, Models, models, schema.GetExtraNamespaces(StrConstants.FileNewline), repoMockup, inputToEntityEqualAssertFunc, entityToViewEqualAssertFunc, createInputFunc, createEntityFunc, createViewFunc));
        }