Created
February 21, 2014 12:34
-
-
Save tanaka-takayoshi/9133490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Configuration; | |
using System.Data.Common; | |
using System.Data.SqlClient; | |
using System.Linq; | |
using System.Web; | |
using Dapper; | |
namespace MetroEShoppingService.Models | |
{ | |
public class UserDevice | |
{ | |
public string Id { get; set; } | |
public string UserId { get; set; } | |
public string DeviceId { get; set; } | |
public string ChannelUri { get; set; } | |
} | |
public class UserDeviceQuery | |
{ | |
private DbConnection connection; | |
public UserDeviceQuery(DbConnection connection) | |
{ | |
this.connection = connection; | |
} | |
public UserDeviceQuery() : | |
this(new SqlConnection(ConfigurationManager.ConnectionStrings["MS_TableConnectionString"].ConnectionString)) | |
{} | |
public UserDevice[] GetAll() | |
{ | |
var sql = @"SELECT * FROM UserDevices"; | |
return connection.Query<UserDevice>(sql).ToArray(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment