Created
February 5, 2020 08:36
-
-
Save sugimomoto/ad75fd95d9dbfcbdf440f11312ff3dfe to your computer and use it in GitHub Desktop.
SqlKata by CData Sansan ADO.NET Provider
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 SqlKata.Compilers; | |
using SqlKata.Execution; | |
using System.Data.CData.Sansan; | |
namespace CData.SqlKata.SampleProject | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// 通常 SqlConnection を渡すが、CData ADO.NET ProviderのConnectionを渡すように変更するだけ。 | |
var connection = new SansanConnection("APIKey=XXXXXX;range=me;"); | |
var compiler = new SqlServerCompiler(); | |
var db = new QueryFactory(connection, compiler); | |
var response = db.Query("Bizcards").Select("BizcardId", "CompanyName").Get<Bizcards>(); | |
foreach (var item in response) | |
{ | |
Console.WriteLine($"BizcardId: {item.BizcardId}; CompanyName: {item.CompanyName}"); | |
} | |
} | |
} | |
internal class Bizcards | |
{ | |
public string BizcardId { get; set; } | |
public string CompanyName { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment