Beispiel #1
0
        private string Write()
        {
            if (string.IsNullOrEmpty(table.NetName) && table.DatabaseSchema != null)
            {
                PrepareSchemaNames.Prepare(table.DatabaseSchema, codeWriterSettings.Namer);
            }

            CodeWriterUtils.WriteFileHeader(classBuilder);
            WriteUsings();
            CodeWriterUtils.BeginNestNamespace(classBuilder, codeWriterSettings);
            var tableOrView         = table is DatabaseView ? "view" : "table";
            var comment             = $"Interface providing repository CRUD operations for the {table.Name} {tableOrView}";
            var interfaceDefinition = $"public partial interface {CodeWriterUtils.GetRepositoryInterfaceName(table)}";

            classBuilder.AppendXmlSummary(comment);
            classBuilder.BeginNest(interfaceDefinition);
            WriteInterfaceMembers();
            classBuilder.EndNest(); // interface
            classBuilder.EndNest(); // namespace
            return(classBuilder.ToString());
        }
Beispiel #2
0
        public string Write()
        {
            if (string.IsNullOrEmpty(table.NetName) && table.DatabaseSchema != null)
            {
                PrepareSchemaNames.Prepare(table.DatabaseSchema, codeWriterSettings.Namer);
            }

            CodeWriterUtils.WriteFileHeader(classBuilder);
            WriteUsings();
            CodeWriterUtils.BeginNestNamespace(classBuilder, codeWriterSettings);

            classBuilder.AppendXmlSummary($"Class representing the {table.Name} table.");
            classBuilder.AppendLine($"[Table(\"\\\"{table.Name}\\\"\")]");
            using (classBuilder.BeginNest($"public partial class {table.NetName}"))
            {
                WriteAllMembers();
            }

            classBuilder.EndNest();
            return(classBuilder.ToString());
        }