Skip to content

Instantly share code, notes, and snippets.

@tanaka-takayoshi
Created February 21, 2014 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanaka-takayoshi/9133490 to your computer and use it in GitHub Desktop.
Save tanaka-takayoshi/9133490 to your computer and use it in GitHub Desktop.
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