Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Dapper Query<T> vs OrmLite's Query<T> ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
LyphTEC  
View profile  
 More options Aug 1 2012, 12:08 am
From: LyphTEC <lyph...@gmail.com>
Date: Tue, 31 Jul 2012 21:08:45 -0700 (PDT)
Local: Wed, Aug 1 2012 12:08 am
Subject: Dapper Query<T> vs OrmLite's Query<T> ?

Hi,

I just updated to the latest version of OrmLite and noticed that Dapper has
now moved to a different namespace and also Query<T> in OrmLite is now
hanging directly IDbConnection (from IDbCommand).

There's a few places where I'm using Dapper's version of Query<T> like so:

result = dbConn.Query<string>("select [Email] from [Contacts]");

but now this is broken because it's trying to use OrmLite's version of
Query<T> and it doesn't support string as the type because of the where T :
new()

Is there any way I can use IDbConnection extensions from Dapper and OrmLite
within the same file and force it to use Dapper's Query() instead?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Demis Bellot  
View profile  
 More options Aug 1 2012, 12:16 am
From: Demis Bellot <demis.bel...@gmail.com>
Date: Wed, 1 Aug 2012 00:16:07 -0400
Local: Wed, Aug 1 2012 12:16 am
Subject: Re: [ServiceStack] Dapper Query<T> vs OrmLite's Query<T> ?

I can think of a couple of options:

1. Both Dapper + OrmLite are extension methods off IDbConnection so just
import the one you use most in your C# .cs file and us the fully qualified
static method for the other.
2. Since Dapper is just a single source include file, rename Dapper's Query.

On a side-note, Dappers:

result = dbConn.Query<string>("select [Email] from [Contacts]");

can be done like this in OrmLite

result = db.GetScalar<string>("select [Email] from [Contacts]");

--
- Demis

http://twitter.com/demisbellot
http://www.servicestack.net/mythz_blog


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
LyphTEC  
View profile  
 More options Aug 1 2012, 12:26 am
From: LyphTEC <lyph...@gmail.com>
Date: Tue, 31 Jul 2012 21:26:39 -0700 (PDT)
Local: Wed, Aug 1 2012 12:26 am
Subject: Re: [ServiceStack] Dapper Query<T> vs OrmLite's Query<T> ?

Thanks Demis.

Looks like the fully qualified static method is the way to go for me as the
file mainly uses OrmLite and I only use Dapper when I need to return a
List<string>.  I actually did not know that you can call the static
extension method directly :)

Also, OrmLite's GetScalar<string> is not the same as I need the result to
be an IEnumerable<string>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Demis Bellot  
View profile  
 More options Aug 1 2012, 12:46 am
From: Demis Bellot <demis.bel...@gmail.com>
Date: Wed, 1 Aug 2012 00:46:14 -0400
Local: Wed, Aug 1 2012 12:46 am
Subject: Re: [ServiceStack] Dapper Query<T> vs OrmLite's Query<T> ?

Oh, in that case you want :)

List<string> results = db.GetFirstColumn<string>(" select [Email] from

> [Contacts] ")

Maybe I should provide a better alias? What would be ideal GetList?

--
- Demis

http://twitter.com/demisbellot
http://www.servicestack.net/mythz_blog


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
LyphTEC  
View profile  
 More options Aug 1 2012, 1:49 am
From: LyphTEC <lyph...@gmail.com>
Date: Tue, 31 Jul 2012 22:49:44 -0700 (PDT)
Local: Wed, Aug 1 2012 1:49 am
Subject: Re: [ServiceStack] Dapper Query<T> vs OrmLite's Query<T> ?

Nice.  Did not know about GetFirstColumn ... yeah, GetList is a probably a
bit more discoverable for me.

Thanks again.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »