CPE_learningsite
This repository has no backups
This repository's network speed is throttled to 100KB/sec
Upgrade your account to fix these warnings, or use backups.vc for automated backups
2177bde9633220cc687f185a683c17205925addf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
<#@ include file="OrmLite.Core.ttinclude" #> <# // Settings ConnectionStringName = ""; // Uses last connection string in config if not specified Namespace = ""; ClassPrefix = ""; ClassSuffix = ""; bool SplitIntoMultipleFiles = false; // if true: Generates one file for every class bool MakeSingular = true; // if true: Changes the classname to singular if tablename is not singular bool UseIdAsPK = true; // if true: Changes the primary key property name to Id bool GenerateConstructor = false; // if true: Generates the default empty constructor bool UseSchemaAttribute = true; // if true: Adds explicit '[Schema]' attribute // Read schema var tables = LoadTables(MakeSingular); /* // Tweak Schema tables["tablename"].Ignore = true; // To ignore a table tables["tablename"].ClassName = "newname"; // To change the class name of a table tables["tablename"]["columnname"].Ignore = true; // To ignore a column tables["tablename"]["columnname"].PropertyName="newname"; // To change the property name of a column tables["tablename"]["columnname"].PropertyType="bool"; // To change the property type of a column */ // Generate output if (tables.Count>0) { #> <# if (string.IsNullOrEmpty(Namespace)) Namespace=ConnectionStringName; if (string.IsNullOrEmpty(Namespace)) Namespace="OrmLitePoco"; var manager = Manager.Create(Host, GenerationEnvironment); manager.StartHeader(); #>// <auto-generated /> // This file was generated by a T4 template. // Don't change it directly as your change would get overwritten. Instead, make changes // to the .tt file (i.e. the T4 template) and save it to regenerate this file. // Make sure the compiler doesn't complain about missing Xml comments #pragma warning disable 1591 using System; using System.Collections.Generic; using System.Linq; using System.Web; using ServiceStack.OrmLite; using ServiceStack.DataAnnotations; using ServiceStack.Model; namespace <#=Namespace #> { <#manager.EndBlock(); #> <# foreach(Table tbl in from t in tables where !t.Ignore select t) { manager.StartNewFile(tbl.Name + ".cs"); #> <# if (MakeSingular) {#> [Alias("<#=tbl.Name#>")] <#}#> <# if (UseSchemaAttribute && !string.IsNullOrEmpty(tbl.Schema) && tbl.Schema != "dbo") {#> [Schema("<#=tbl.Schema#>")] <#}#> public partial class <#=tbl.ClassName#><#if (tbl.HasPK() && UseIdAsPK) { #> : IHasId<<#=tbl.PK.PropertyType#>><#}#> { <# if (GenerateConstructor) { #> public <#=tbl.ClassName#>() { } <# } foreach(Column col in from c in tbl.Columns where !c.Ignore select c) { if ((col.Name!=col.PropertyName) || (col.IsPK && UseIdAsPK)) { #> [Alias("<#=col.Name#>")] <# } if (col.PropertyType == "string" && col.Size > 0) { #> [StringLength(<#=col.Size#>)] <# } if (col.IsAutoIncrement) { #> [AutoIncrement] <# } if (col.IsComputed) { #> [Compute] <# } if (col.IsNullable != true && col.IsAutoIncrement != true) { #> [Required] <# } if (!col.IsPK){#> public <#=col.ProperPropertyType#> <#=col.PropertyName#> { get; set;} <# } if (col.IsPK && UseIdAsPK) { #> public <#=col.ProperPropertyType#> Id { get; set;} <# } if (col.IsPK && !UseIdAsPK) { #> [PrimaryKey] public <#=col.ProperPropertyType#> <#=col.PropertyName#> { get; set;} <# } #> <# } #> } <# manager.EndBlock(); #> <# } #> <#manager.StartFooter(); #> } #pragma warning restore 1591 <#manager.EndBlock(); #> <#manager.Process(SplitIntoMultipleFiles); #> <# } #> |
Commits for CPE_learningsite/CPE/CPE.App/CPE.App.Api/OrmLite.Poco.tt
Revision | Author | Commited | Message |
---|---|---|---|
4cd176 ... | v.shishlov | Fri 27 Aug, 2021 14:33:17 +0000 | initial commit |