Example #1
0
        /// <summary>
        /// Méthode générant le code d'une classe.
        /// </summary>
        /// <param name="item">Classe concernée.</param>
        /// <param name="ns">Namespace.</param>
        public void Generate(ModelClass item, ModelNamespace ns)
        {
            var fileName = Path.Combine(GetDirectoryForModelClass(_parameters.OutputDirectory, item.DataContract.IsPersistent, _rootNamespace, item.Namespace.Name), item.Name + ".cs");

            using (var w = new CSharpWriter(fileName))
            {
                Console.WriteLine("Generating class " + ns.Name + "." + item.Name);

                GenerateUsings(w, item);
                w.WriteLine();
                w.WriteNamespace($"{_rootNamespace}.{ns.Name}");
                w.WriteSummary(1, item.Comment);
                GenerateClassDeclaration(w, item);
                w.WriteLine("}");
            }
        }