Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug: MySql QueryById does not work. Added dblinq like expressio…

…ns to postgres provider
  • Loading branch information...
commit 079503e6357cb06ff289e7c8b76243cd2b4a111c 1 parent 19e3b6f
@angelcolmenares angelcolmenares authored
View
27 src/PostgreSQLExpressionsTest/AssemblyInfo.cs
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("PostgreSQLExpressionsTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("angel")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
View
239 src/PostgreSQLExpressionsTest/Main.cs
@@ -0,0 +1,239 @@
+using System;
+using System.Linq;
+using System.ComponentModel.DataAnnotations;
+using System.Collections.Generic;
+using System.Data;
+
+using ServiceStack.Common.Utils;
+using ServiceStack.DataAnnotations;
+using ServiceStack.Common.Extensions;
+using System.Reflection;
+
+using ServiceStack.OrmLite;
+using ServiceStack.OrmLite.PostgreSQL;
+
+
+namespace PostgreSQLExpressionsTest
+{
+ public class Author{
+ public Author(){}
+ [AutoIncrement]
+ [Alias("AuthorID")]
+ public Int32 Id { get; set;}
+ [Index(Unique = true)]
+ [StringLength(40)]
+ public string Name { get; set;}
+ public DateTime Birthday { get; set;}
+ public DateTime ? LastActivity { get; set;}
+ public Decimal? Earnings { get; set;}
+ public bool Active { get; set; }
+ [StringLength(80)]
+ [Alias("JobCity")]
+ public string City { get; set;}
+ [StringLength(80)]
+ [Alias("Comment")]
+ public string Comments { get; set;}
+ public Int16 Rate{ get; set;}
+ }
+
+
+
+ class MainClass
+ {
+ public static void Main (string[] args)
+ {
+ Console.WriteLine ("Hello World!");
+
+ OrmLiteConfig.DialectProvider = PostgreSQLDialectProvider.Instance;
+ SqlExpressionVisitor<Author> ev = OrmLiteConfig.DialectProvider.ExpressionVisitor<Author>();
+
+ using (IDbConnection db =
+ "Server=localhost;Port=5432;User Id=postgres; Password=postgres; Database=jasperserver".OpenDbConnection())
+ using ( IDbCommand dbCmd = db.CreateCommand())
+ {
+ dbCmd.DropTable<Author>();
+ dbCmd.CreateTable<Author>();
+ dbCmd.DeleteAll<Author>();
+
+ List<Author> authors = new List<Author>();
+ authors.Add(new Author(){Name="Demis Bellot",Birthday= DateTime.Today.AddYears(-20),Active=true,Earnings= 99.9m,Comments="CSharp books", Rate=10, City="London"});
+ authors.Add(new Author(){Name="Angel Colmenares",Birthday= DateTime.Today.AddYears(-25),Active=true,Earnings= 50.0m,Comments="CSharp books", Rate=5, City="Bogota"});
+ authors.Add(new Author(){Name="Adam Witco",Birthday= DateTime.Today.AddYears(-20),Active=true,Earnings= 80.0m,Comments="Math Books", Rate=9, City="London"});
+ authors.Add(new Author(){Name="Claudia Espinel",Birthday= DateTime.Today.AddYears(-23),Active=true,Earnings= 60.0m,Comments="Cooking books", Rate=10, City="Bogota"});
+ authors.Add(new Author(){Name="Libardo Pajaro",Birthday= DateTime.Today.AddYears(-25),Active=true,Earnings= 80.0m,Comments="CSharp books", Rate=9, City="Bogota"});
+ authors.Add(new Author(){Name="Jorge Garzon",Birthday= DateTime.Today.AddYears(-28),Active=true,Earnings= 70.0m,Comments="CSharp books", Rate=9, City="Bogota"});
+ authors.Add(new Author(){Name="Alejandro Isaza",Birthday= DateTime.Today.AddYears(-20),Active=true,Earnings= 70.0m,Comments="Java books", Rate=0, City="Bogota"});
+ authors.Add(new Author(){Name="Wilmer Agamez",Birthday= DateTime.Today.AddYears(-20),Active=true,Earnings= 30.0m,Comments="Java books", Rate=0, City="Cartagena"});
+ authors.Add(new Author(){Name="Rodger Contreras",Birthday= DateTime.Today.AddYears(-25),Active=true,Earnings= 90.0m,Comments="CSharp books", Rate=8, City="Cartagena"});
+ authors.Add(new Author(){Name="Chuck Benedict",Birthday= DateTime.Today.AddYears(-22),Active=true,Earnings= 85.5m,Comments="CSharp books", Rate=8, City="London"});
+ authors.Add(new Author(){Name="James Benedict II",Birthday= DateTime.Today.AddYears(-22),Active=true,Earnings= 85.5m,Comments="Java books", Rate=5, City="Berlin"});
+ authors.Add(new Author(){Name="Ethan Brown",Birthday= DateTime.Today.AddYears(-20),Active=true,Earnings= 45.0m,Comments="CSharp books", Rate=5, City="Madrid"});
+ authors.Add(new Author(){Name="Xavi Garzon",Birthday= DateTime.Today.AddYears(-22),Active=true,Earnings= 75.0m,Comments="CSharp books", Rate=9, City="Madrid"});
+ authors.Add(new Author(){Name="Luis garzon",Birthday= DateTime.Today.AddYears(-22),Active=true,Earnings= 85.0m,Comments="CSharp books", Rate=10, City="Mexico"});
+
+ dbCmd.InsertAll(authors);
+
+
+ // lets start !
+
+ // select authors born 20 year ago
+ int year = DateTime.Today.AddYears(-20).Year;
+ int expected=5;
+
+ ev.Where(rn=> rn.Birthday>=new DateTime(year, 1,1) && rn.Birthday<=new DateTime(year, 12,31));
+ List<Author> result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ // select authors from London, Berlin and Madrid : 6
+ expected=6;
+ ev.Where(rn=> Sql.In( rn.City, new object[]{"London", "Madrid", "Berlin"}) );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ // select authors from Bogota and Cartagena : 7
+ expected=7;
+ List<object> cities = new List<object>(new object[]{"Bogota", "Cartagena"} ); //works only object..
+ ev.Where(rn=> Sql.In( rn.City, cities) );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+
+ // select authors which name starts with A
+ expected=3;
+ ev.Where(rn=> rn.Name.StartsWith("A") );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ // select authors which name ends with Garzon o GARZON o garzon ( no case sensitive )
+ expected=3;
+ ev.Where(rn=> rn.Name.ToUpper().EndsWith("GARZON") );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ // select authors which name ends with garzon ( no case sensitive )
+ expected=3;
+ ev.Where(rn=> rn.Name.EndsWith("garzon") );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+
+ // select authors which name contains Benedict
+ expected=2;
+ ev.Where(rn=> rn.Name.Contains("Benedict") );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+
+ // select authors with Earnings <= 50
+ expected=3;
+ ev.Where(rn=> rn.Earnings<=50 );
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ // select authors with Rate = 10 and city=Mexio
+ expected=1;
+ ev.Where(rn=> rn.Rate==10 && rn.City=="Mexico");
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ // enough selecting, lets update;
+ // set Active=false where rate =0
+ expected=2;
+ ev.Where(rn=> rn.Rate==0 ).Update(rn=> rn.Active);
+ var rows = dbCmd.Update( new Author(){ Active=false }, ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, rows, expected==rows);
+
+ // insert values only in Id, Name, Birthday, Rate and Active fields
+ expected=4;
+ ev.Insert(rn =>new { rn.Id, rn.Name, rn.Birthday, rn.Active, rn.Rate} );
+ dbCmd.Insert( new Author(){Active=false, Rate=0, Name="Victor Grozny", Birthday=DateTime.Today.AddYears(-18) }, ev);
+ dbCmd.Insert( new Author(){Active=false, Rate=0, Name="Ivan Chorny", Birthday=DateTime.Today.AddYears(-19) }, ev);
+ ev.Where(rn=> !rn.Active);
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+ //update comment for City == null
+ expected=2;
+ ev.Where( rn => rn.City==null ).Update(rn=> rn.Comments);
+ rows=dbCmd.Update(new Author(){Comments="No comments"}, ev);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, rows, expected==rows);
+
+ // delete where City is null
+ expected=2;
+ rows = dbCmd.Delete( ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, rows, expected==rows);
+
+
+ // lets select all records ordered by Rate Descending and Name Ascending
+ expected=14;
+ ev.Where().OrderBy(rn=> new{ at=Sql.Desc(rn.Rate), rn.Name }); // clear where condition
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+ Console.WriteLine(ev.OrderByExpression);
+ var author = result.FirstOrDefault();
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Claudia Espinel", author.Name, "Claudia Espinel"==author.Name);
+
+ // select only first 5 rows ....
+
+ expected=5;
+ ev.Limit(5); // note: order is the same as in the last sentence
+ result=dbCmd.Select(ev);
+ Console.WriteLine(ev.WhereExpression);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+
+ // lets select only Name and City (name will be "UPPERCASED" )
+
+ ev.Select(rn=> new { at= Sql.As( rn.Name.ToUpper(), "Name" ), rn.City} );
+ Console.WriteLine(ev.SelectExpression);
+ result=dbCmd.Select(ev);
+ author = result.FirstOrDefault();
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Claudia Espinel".ToUpper(), author.Name, "Claudia Espinel".ToUpper()==author.Name);
+
+ //paging :
+ ev.Limit(0,4);// first page, page size=4;
+ result=dbCmd.Select(ev);
+ author = result.FirstOrDefault();
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Claudia Espinel".ToUpper(), author.Name, "Claudia Espinel".ToUpper()==author.Name);
+
+ ev.Limit(4,4);// second page
+ result=dbCmd.Select(ev);
+ author = result.FirstOrDefault();
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Jorge Garzon".ToUpper(), author.Name, "Jorge Garzon".ToUpper()==author.Name);
+
+ ev.Limit(8,4);// third page
+ result=dbCmd.Select(ev);
+ author = result.FirstOrDefault();
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Rodger Contreras".ToUpper(), author.Name, "Rodger Contreras".ToUpper()==author.Name);
+
+
+ // select distinct..
+ ev.Limit().OrderBy(); // clear limit and order for postgres
+ ev.SelectDistinct(r=>r.City);
+ expected=6;
+ result=dbCmd.Select(ev);
+ Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
+
+
+ Console.ReadLine();
+ Console.WriteLine("Press Enter to continue");
+
+ }
+
+ Console.WriteLine ("This is The End my friend!");
+ }
+ }
+}
View
68 src/PostgreSQLExpressionsTest/PostgreSQLExpressionsTest.csproj
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{348E82EE-7D30-4D60-90E5-CA60C290C589}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>PostgreSQLExpressionsTest</RootNamespace>
+ <AssemblyName>PostgreSQLExpressionsTest</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Externalconsole>true</Externalconsole>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Externalconsole>true</Externalconsole>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="Mono.Security">
+ <HintPath>..\..\lib\Mono.Security.dll</HintPath>
+ </Reference>
+ <Reference Include="Npgsql">
+ <HintPath>..\..\lib\Npgsql.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Common">
+ <HintPath>..\..\lib\ServiceStack.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Interfaces">
+ <HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Text">
+ <HintPath>..\..\lib\ServiceStack.Text.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <ProjectReference Include="..\ServiceStack.OrmLite\ServiceStack.OrmLite.csproj">
+ <Project>{96179AC6-F6F1-40C3-9FDD-4F6582F54C5C}</Project>
+ <Name>ServiceStack.OrmLite</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ServiceStack.OrmLite.PostgreSQL\ServiceStack.OrmLite.PostgreSQL.csproj">
+ <Project>{3220F088-BDD0-6979-AC0C-8C541C2E7DE5}</Project>
+ <Name>ServiceStack.OrmLite.PostgreSQL</Name>
+ </ProjectReference>
+ </ItemGroup>
+</Project>
View
2  src/ServiceStack.OrmLite.PostgreSQL/PostgreSQLDialectProvider.cs
@@ -146,7 +146,7 @@ public override long GetLastInsertId(IDbCommand command)
public override SqlExpressionVisitor<T> ExpressionVisitor<T>()
{
- throw new NotImplementedException();
+ return new PostgreSQLExpressionVisitor<T>();
}
}
}
View
124 src/ServiceStack.OrmLite.PostgreSQL/PostgreSQLExpressionVisitor.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Collections.ObjectModel;
+using System.Linq.Expressions;
+using ServiceStack.OrmLite;
+
+namespace ServiceStack.OrmLite.PostgreSQL
+{
+ public class PostgreSQLExpressionVisitor<T>:SqlExpressionVisitor<T>
+ {
+ public PostgreSQLExpressionVisitor():base()
+ {
+ }
+
+ protected override string VisitMethodCall(MethodCallExpression m)
+ {
+ List<Object> args = this.VisitExpressionList(m.Arguments);
+
+ Object r ;
+ if( m.Object!=null)
+ r=Visit(m.Object);
+ else{
+ r= args[0];
+ args.RemoveAt(0);
+ }
+
+ switch(m.Method.Name){
+ case "ToUpper":
+ return string.Format("upper({0})",r);
+ case "ToLower":
+ return string.Format("lower({0})",r);
+ case "StartsWith": //LEFT( title, 1) = '#'
+ return string.Format("upper({0}) like '{1}%'",r,RemoveQuote(args[0].ToString().ToUpper()) );
+ case "EndsWith":
+ return string.Format("upper({0}) like '%{1}'",r,RemoveQuote(args[0].ToString().ToUpper()) );
+ case "Contains":
+ return string.Format("upper({0}) like '%{1}%'",r,RemoveQuote(args[0].ToString()).ToUpper() );
+ case "Substring":
+ var startIndex = Int32.Parse(args[0].ToString() ) +1;
+ if (args.Count==2){
+ var length = Int32.Parse( args[1].ToString() );
+ return string.Format("substring({0} from {1} for {2})",
+ r,
+ startIndex,
+ length);
+ }
+ else
+ return string.Format("substring({0} from {1})",
+ r,
+ startIndex);
+ case "Round":
+ case "Floor":
+ case "Ceiling":
+ case "Coalesce":
+ case "Abs":
+ case "Sum":
+ return string.Format("{0}({1}{2})",
+ m.Method.Name,
+ r,
+ args.Count==1? string.Format(",{0}", args[0]):"" );
+ case "Concat":
+ StringBuilder s = new StringBuilder();
+ foreach(Object e in args ){
+ s.AppendFormat( " || {0}", e);
+ }
+ return string.Format("{0}{1}",r, s.ToString());
+
+ case "In":
+
+ var member = Expression.Convert(m.Arguments[1], typeof(object));
+ var lambda = Expression.Lambda<Func<object>>(member);
+ var getter = lambda.Compile();
+
+ var inArgs = getter() as IList<Object>;
+
+
+ StringBuilder sIn = new StringBuilder();
+ foreach(Object e in inArgs ){
+ sIn.AppendFormat("{0}{1}",
+ sIn.Length>0 ? ",":"",
+ OrmLiteConfig.DialectProvider.GetQuotedValue(e, e.GetType()) );
+ }
+
+ return string.Format("{0} {1} ({2})", r, m.Method.Name, sIn.ToString() );
+ case "Desc":
+ return string.Format("{0} DESC", r);
+ case "As":
+ return string.Format("{0} As {1}", r,
+ OrmLiteConfig.DialectProvider.GetNameDelimited( RemoveQuote( args[0].ToString() ) ) );
+ case "ToString":
+ return r.ToString();
+ default:
+ Console.WriteLine("******* Returning '{0}' for '{1}' *******", r, m.Method.Name);
+
+ StringBuilder s2 = new StringBuilder();
+ foreach(Object e in args ){
+ s2.AppendFormat(",{0}",
+ OrmLiteConfig.DialectProvider.GetQuotedValue(e, e.GetType()) );
+ }
+ return string.Format("{0}({1}{2})",m.Method.Name,r, s2.ToString());
+
+ }
+
+ }
+
+ public override string LimitExpression{
+ get{
+ if(!Rows.HasValue) return "";
+ string offset;
+ if(Skip.HasValue){
+ offset= string.Format(" OFFSET {0}", Skip.Value );
+ }
+ else{
+ offset=string.Empty;
+ }
+ return string.Format("LIMIT {0}{1}", Rows.Value, offset);
+ }
+ }
+
+
+ }
+}
View
11 src/ServiceStack.OrmLite.PostgreSQL/ServiceStack.OrmLite.PostgreSQL.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,7 +12,6 @@
<AssemblyName>ServiceStack.OrmLite.PostgreSQL</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -35,20 +34,20 @@
<Reference Include="Mono.Security">
<HintPath>..\..\lib\Mono.Security.dll</HintPath>
</Reference>
- <Reference Include="Npgsql, Version=2.0.11.92, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Npgsql.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
+ <Reference Include="Npgsql">
+ <HintPath>..\..\lib\Npgsql.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="PostgreSQLDialectProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="PostgreSQLExpressionVisitor.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
2  src/ServiceStack.OrmLite/OrmLiteReadExtensions.cs
@@ -264,7 +264,7 @@ public static T QueryById<T>(this IDbCommand dbCmd, object value)
if (dbCmd.Parameters.Count != 1
|| ((IDbDataParameter)dbCmd.Parameters[0]).ParameterName != ModelDefinition<T>.PrimaryKeyName
|| lastQueryType != typeof(T))
- SetFilter<T>(dbCmd, OrmLiteConfig.DialectProvider.GetNameDelimited(ModelDefinition<T>.PrimaryKeyName), value);
+ SetFilter<T>(dbCmd, ModelDefinition<T>.PrimaryKeyName, value);
((IDbDataParameter)dbCmd.Parameters[0]).Value = value;
Please sign in to comment.
Something went wrong with that request. Please try again.