Skip to content
This repository
Browse code

Update #283 - Prove that we work with mappers like Dapper

  • Loading branch information...
commit d0bbbf1492b4eaeb36f5c325fa586d8f14089e50 1 parent 2abbb61
Anthony van der Hoorn authored March 26, 2013
8  source/Glimpse.Mvc3.MusicStore.Sample/Controllers/HomeController.cs
@@ -7,6 +7,7 @@
7 7
 using System.Linq;
8 8
 using System.Transactions;
9 9
 using System.Web.Mvc;
  10
+using Dapper;
10 11
 using MvcMusicStore.Models;
11 12
 
12 13
 namespace MvcMusicStore.Controllers
@@ -175,12 +176,7 @@ private List<Album> GetTopSellingAlbums(int count)
175 176
                     scope.Complete();
176 177
                 }
177 178
 
178  
-                using (var command = connection.CreateCommand())
179  
-                {
180  
-                    command.CommandText = "SELECT COUNT(*) FROM Albums WHERE Title LIKE 'K%'";
181  
-                    command.CommandType = CommandType.Text;
182  
-                    result3 = (int)command.ExecuteScalar();
183  
-                } 
  179
+                var albums = connection.Query<Album>("SELECT * FROM Albums WHERE Title LIKE 'K%'");
184 180
             }
185 181
 
186 182
             var test = storeDB.Database.ExecuteSqlCommand("SELECT count(*) FROM Albums WHERE Title LIKE 'The%'");
3,362  source/Glimpse.Mvc3.MusicStore.Sample/Framework/SqlMapper.cs
3362 additions, 0 deletions not shown
1  source/Glimpse.Mvc3.MusicStore.Sample/Glimpse.Mvc3.MusicStore.Sample.csproj
@@ -85,6 +85,7 @@
85 85
     <Compile Include="Controllers\ShoppingCartController.cs" />
86 86
     <Compile Include="Controllers\StoreController.cs" />
87 87
     <Compile Include="Controllers\StoreManagerController.cs" />
  88
+    <Compile Include="Framework\SqlMapper.cs" />
88 89
     <Compile Include="Global.asax.cs">
89 90
       <DependentUpon>Global.asax</DependentUpon>
90 91
     </Compile>

0 notes on commit d0bbbf1

Please sign in to comment.
Something went wrong with that request. Please try again.