|
1 | 1 | <# |
2 | 2 | // Copyright (C) Simon Hughes 2012 |
3 | | -// v3.1.2 |
| 3 | +// v3.1.3 |
4 | 4 | // If you want to submit a pull request, please modify the Generator C# project as this file |
5 | 5 | // is automatically constructed from the C# Generator project during the build process. |
6 | 6 | #> |
|
916 | 916 | "object", |
917 | 917 | "microsoft.sqlserver.types.sqlgeography", |
918 | 918 | "microsoft.sqlserver.types.sqlgeometry", |
| 919 | + "sqlgeography", |
| 920 | + "sqlgeometry", |
919 | 921 | "system.data.entity.spatial.dbgeography", |
920 | 922 | "system.data.entity.spatial.dbgeometry", |
| 923 | + "dbgeography", |
| 924 | + "dbgeometry", |
921 | 925 | "system.data.entity.hierarchy.hierarchyid", |
| 926 | + "hierarchyid", |
922 | 927 | "nettopologysuite.geometries.point", |
923 | 928 | "nettopologysuite.geometries.geometry" |
924 | 929 | }; |
|
945 | 950 |
|
946 | 951 | public void CleanUpDefault() |
947 | 952 | { |
948 | | - if (string.IsNullOrWhiteSpace(Default)) |
| 953 | + if (string.IsNullOrWhiteSpace(Default) || IsSpatial) |
949 | 954 | { |
950 | 955 | Default = string.Empty; |
951 | 956 | return; |
|
1226 | 1231 | { |
1227 | 1232 | public static string Version() |
1228 | 1233 | { |
1229 | | - return "v3.1.2"; |
| 1234 | + return "v3.1.3"; |
1230 | 1235 | } |
1231 | 1236 | } |
1232 | 1237 |
|
|
4889 | 4894 | var sb = new StringBuilder(255); |
4890 | 4895 | sb.AppendFormat(".HasColumnName(@\"{0}\")", c.DbName); |
4891 | 4896 |
|
4892 | | - var doNotSpecifySize = false; |
4893 | | - if (!c.IsMaxLength && c.MaxLength > 0) |
4894 | | - doNotSpecifySize = (DatabaseReader.DoNotSpecifySizeForMaxLength && c.MaxLength > 4000); // Issue #179 |
4895 | | - |
4896 | 4897 | if (!string.IsNullOrEmpty(c.SqlPropertyType)) |
4897 | 4898 | sb.AppendFormat(".HasColumnType(\"{0}\")", c.SqlPropertyType); |
4898 | 4899 |
|
|
4906 | 4907 |
|
4907 | 4908 | if (!c.IsMaxLength && c.MaxLength > 0) |
4908 | 4909 | { |
| 4910 | + var doNotSpecifySize = (DatabaseReader.DoNotSpecifySizeForMaxLength && c.MaxLength > 4000); // Issue #179 |
| 4911 | + |
4909 | 4912 | if (doNotSpecifySize) |
4910 | 4913 | sb.Append(".HasMaxLength(null)"); |
4911 | 4914 | else |
|
5967 | 5970 | { |
5968 | 5971 | public Dictionary<string, string> GetMapping() |
5969 | 5972 | { |
| 5973 | + var geographyType = Settings.TemplateType == TemplateType.Ef6 ? "DbGeography" : "NetTopologySuite.Geometries.Point"; |
| 5974 | + var geometryType = Settings.TemplateType == TemplateType.Ef6 ? "DbGeometry" : "NetTopologySuite.Geometries.Geometry"; |
| 5975 | + |
5970 | 5976 | // [Database type] = Language type |
5971 | 5977 | return new Dictionary<string, string> |
5972 | 5978 | { |
|
5993 | 5999 | { "fixed", "decimal" }, |
5994 | 6000 | { "float unsigned", "decimal" }, |
5995 | 6001 | { "float", "double" }, |
5996 | | - { "geography", Settings.TemplateType == TemplateType.Ef6 ? "Spatial.DbGeography" : "NetTopologySuite.Geometries.Point" }, |
5997 | | - { "geometry", Settings.TemplateType == TemplateType.Ef6 ? "Spatial.DbGeometry" : "NetTopologySuite.Geometries.Geometry" }, |
| 6002 | + { "geography", Settings.DisableGeographyTypes ? string.Empty : geographyType }, |
| 6003 | + { "geometry", Settings.DisableGeographyTypes ? string.Empty : geometryType }, |
5998 | 6004 | { "int unsigned", "long" }, |
5999 | 6005 | { "int", "int" }, |
6000 | 6006 | { "integer unsigned", "long" }, |
|
6103 | 6109 | { "citext", "string" }, |
6104 | 6110 | { "date", "DateTime" }, |
6105 | 6111 | { "double precision", "double" }, |
6106 | | - { "geometry", "PostgisGeometry" }, |
| 6112 | + { "geometry", Settings.DisableGeographyTypes ? string.Empty : "PostgisGeometry" }, |
6107 | 6113 | { "hstore", "Dictionary<string, string>" }, |
6108 | 6114 | { "inet", "NpgsqlInet" }, |
6109 | 6115 | { "integer", "int" }, |
|
6151 | 6157 | // [Database type] = Language type |
6152 | 6158 | public Dictionary<string, string> GetMapping() |
6153 | 6159 | { |
| 6160 | + var geographyType = Settings.TemplateType == TemplateType.Ef6 ? "DbGeography" : "NetTopologySuite.Geometries.Point"; |
| 6161 | + var geometryType = Settings.TemplateType == TemplateType.Ef6 ? "DbGeometry" : "NetTopologySuite.Geometries.Geometry"; |
| 6162 | + |
6154 | 6163 | return new Dictionary<string, string> |
6155 | 6164 | { |
6156 | 6165 | { string.Empty, "string" }, // default |
|
6163 | 6172 | { "datetimeoffset", "DateTimeOffset" }, |
6164 | 6173 | { "decimal", "decimal" }, |
6165 | 6174 | { "float", "double" }, |
6166 | | - { "geography", Settings.TemplateType == TemplateType.Ef6 ? "Spatial.DbGeography" : "NetTopologySuite.Geometries.Point" }, |
6167 | | - { "geometry", Settings.TemplateType == TemplateType.Ef6 ? "Spatial.DbGeometry" : "NetTopologySuite.Geometries.Geometry" }, |
| 6175 | + { "geography", Settings.DisableGeographyTypes ? string.Empty : geographyType }, |
| 6176 | + { "geometry", Settings.DisableGeographyTypes ? string.Empty : geometryType }, |
6168 | 6177 | { "hierarchyid", "Hierarchy.HierarchyId" }, |
6169 | 6178 | { "image", "byte[]" }, |
6170 | 6179 | { "int", "int" }, |
|
6207 | 6216 | { "datetimeoffset", "string" }, |
6208 | 6217 | { "decimal", "Number" }, |
6209 | 6218 | { "float", "Number" }, |
6210 | | - { "geography", "string" }, |
6211 | | - { "geometry", "string" }, |
| 6219 | + { "geography", Settings.DisableGeographyTypes ? string.Empty : "string" }, |
| 6220 | + { "geometry", Settings.DisableGeographyTypes ? string.Empty : "string" }, |
6212 | 6221 | { "hierarchyid", "string" }, |
6213 | 6222 | { "image", "string" }, |
6214 | 6223 | { "int", "Number" }, |
@@ -14137,7 +14146,7 @@ SELECT SERVERPROPERTY('Edition') AS Edition, |
14137 | 14146 | + (p.Mode == StoredProcedureParameterMode.In ? "Input" : "Output") |
14138 | 14147 | + (p.Mode == StoredProcedureParameterMode.In |
14139 | 14148 | ? ", Value = " + (isGeography |
14140 | | - ? string.Format("SqlGeography.Parse({0}.AsText())", p.NameHumanCase) |
| 14149 | + ? string.Format("Microsoft.SqlServer.Types.SqlGeography.Parse({0}.AsText())", p.NameHumanCase) |
14141 | 14150 | : p.NameHumanCase + getValueOrDefault) |
14142 | 14151 | : string.Empty) |
14143 | 14152 | + (p.MaxLength != 0 ? ", Size = " + p.MaxLength : string.Empty) |
@@ -15192,6 +15201,7 @@ using {{this}};{{#newline}} |
15192 | 15201 | {{#newline}} |
15193 | 15202 | // Table Valued Functions{{#newline}} |
15194 | 15203 | {{#each tableValuedFunctions}} |
| 15204 | +{{#newline}} |
15195 | 15205 | [DbFunction(""{{DbContextName}}"", ""{{Name}}"")]{{#newline}} |
15196 | 15206 | [CodeFirstStoreFunctions.DbFunctionDetails(DatabaseSchema = ""{{Schema}}""{{#if SingleReturnModel}}, ResultColumnName = ""{{SingleReturnColumnName}}""{{/if}})]{{#newline}} |
15197 | 15207 | IQueryable<{{ReturnClassName}}> {{ExecName}}({{WriteStoredProcFunctionParamsFalse}});{{#newline}} |
@@ -15239,7 +15249,9 @@ using {{this}};{{#newline}} |
15239 | 15249 | } |
15240 | 15250 |
|
15241 | 15251 | if (data.hasStoredProcs) |
| 15252 | + { |
15242 | 15253 | usings.Add("System.Collections.Generic"); |
| 15254 | + } |
15243 | 15255 |
|
15244 | 15256 | if (!Settings.UseInheritedBaseInterfaceFunctions) |
15245 | 15257 | { |
|
0 commit comments