Created
November 20, 2019 04:33
-
-
Save sugimomoto/f137df6dbbfafd3d8b8386df076b359e to your computer and use it in GitHub Desktop.
DapperSample.CDataDriverSansan.cs
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 Dapper; | |
using System; | |
using System.Data.CData.Sansan; | |
using System.Linq; | |
namespace DapperSample.CDataDriverSansan | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Hello World!"); | |
string sqlBizCards = "SELECT * FROM BizCards"; | |
using (var connection = new SansanConnection("APIKey=XXXXXXXXXX;range=me;")) | |
{ | |
var bizcards = connection.Query<BizCard>(sqlBizCards).ToList(); | |
Console.WriteLine(bizcards.Count); | |
foreach (var item in bizcards) | |
Console.WriteLine($"BizcardId: {item.BizcardId}; FirstName: {item.FirstName}; LastName: {item.LastName} "); | |
} | |
} | |
} | |
public class BizCard | |
{ | |
public string BizcardId { get; set; } | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment