diff --git a/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj b/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj index c5b375b..1a12f2d 100644 --- a/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj +++ b/src/EntityFramework6.Npgsql/EntityFramework6.Npgsql.csproj @@ -60,7 +60,9 @@ - + + Designer + diff --git a/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.Manifest.xml b/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.Manifest.xml index 78e4d75..9841241 100644 --- a/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.Manifest.xml +++ b/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.Manifest.xml @@ -31,6 +31,14 @@ + + + + + + + + diff --git a/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs b/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs index f7d4d21..a27d821 100644 --- a/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs +++ b/src/EntityFramework6.Npgsql/NpgsqlProviderManifest.cs @@ -162,7 +162,8 @@ public override TypeUsage GetEdmType([NotNull] TypeUsage storeType) return TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, false); case "text": case "xml": - return TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, false); + case "citext": + return TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, false); case "timestamp": // TODO: make sure the arguments are correct here if (storeType.Facets.TryGetValue(PrecisionFacet, false, out facet) && diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs b/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs index b35586f..5d6e496 100644 --- a/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs +++ b/src/EntityFramework6.Npgsql/SqlGenerators/SqlBaseGenerator.cs @@ -1094,7 +1094,9 @@ VisitedExpression VisitFunction(EdmFunction function, IList args, return new FunctionExpression("uuid_generate_v4"); case "TruncateTime": return new TruncateTimeExpression("day", args[0].Accept(this)); - + case "CreateTime": + return new MakeTimeExpression(args[0].Accept(this), args[1].Accept(this), args[2].Accept(this)); + //return MakeTime(args[0].Accept(this), args[1].Accept(this), args[2].Accept(this)); default: throw new NotSupportedException("NotSupported " + function.Name); } @@ -1287,6 +1289,17 @@ VisitedExpression Substring(VisitedExpression source, VisitedExpression start, V return substring; } + //hour int, min int, sec double precision + VisitedExpression MakeTime(VisitedExpression hour, VisitedExpression min, VisitedExpression sec) + { + var substring = new FunctionExpression("make_interval"); + //make_interval(hours => 9,minutes=>); + substring.AddArgument(hour); + substring.AddArgument(min); + substring.AddArgument(sec); + return substring; + } + VisitedExpression Substring(VisitedExpression source, VisitedExpression start) { var substring = new FunctionExpression("substr"); diff --git a/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs b/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs index d1e94b2..9c0bfc2 100644 --- a/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs +++ b/src/EntityFramework6.Npgsql/SqlGenerators/VisitedExpression.cs @@ -1108,4 +1108,34 @@ internal override void WriteSql(StringBuilder sqlText) base.WriteSql(sqlText); } } + + internal class MakeTimeExpression : VisitedExpression + { + readonly VisitedExpression _hours; + readonly VisitedExpression _minutes; + readonly VisitedExpression _seconds; + + public MakeTimeExpression(VisitedExpression hours, VisitedExpression minutes, VisitedExpression seconds) + { + _hours = hours; + _minutes = minutes; + _seconds = seconds; + } + + internal override void WriteSql(StringBuilder sqlText) + { + sqlText.Append("make_interval"); + sqlText.Append("("); + sqlText.Append("hours => "); + _hours.WriteSql(sqlText); + sqlText.Append(","); + sqlText.Append("mins => "); + _minutes.WriteSql(sqlText); + sqlText.Append(","); + sqlText.Append("secs => "); + _seconds.WriteSql(sqlText); + sqlText.Append(")"); + base.WriteSql(sqlText); + } + } }