项目作者: bbsimonbb

项目描述 :
Typed raw SQL for everybody ! This is the original VS Extension.
高级语言: C#
项目地址: git://github.com/bbsimonbb/query-first.git
创建时间: 2016-04-10T19:22:28Z
项目社区:https://github.com/bbsimonbb/query-first

开源协议:MIT License

下载


query-first

A much smarter way to work with SQL.

Query first is a “lightweight, low ceremony” data access tech, for working with SQL in C# projects. Develop your queries using the QueryFirst .sql template (in Visual C# items). When you save your file, QueryFirst will generate a wrapper class and a POCO for your results.

You will need to install the VSIX, then in your project, create qfconfig.json beside or above your .sql files. To create a query, choose New QueryFirstQuery from the Add => New Item dialogue.

  1. // qfconfig.json
  2. {
  3. "defaultConnection": "Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True",
  4. "provider:["System.Data.SqlClient"(the default)/"MySql.Data.MySqlClient"/"Npgsql"],
  5. "helperAssembly":[pathToDll],
  6. "makeSelfTest":true/false
  7. }
  8. // QfRuntimeConnection.cs
  9. using System.Data;
  10. using System.Data.SqlClient;
  11. namespace CoreWebAppSqlServer
  12. {
  13. public class QfRuntimeConnection
  14. {
  15. public static IDbConnection GetConnection()
  16. {
  17. return new SqlConnection("Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True");
  18. }
  19. }
  20. }

Nikhil Gupta, this is Simon Boddy, bbsimonbb@gmail.com, proving ownership of this repo !

Read more and download the VSIX here. There’s a little code project article here.