WebApi框架搭建(二)集成ORM

1、添加引用:FluentData.NetCore.dll

2、安装包:

  System.Data.SqlClient

  System.Configuration.ConfigurationManager

3、Startup.cs ConfigureServices方法,添加:

  DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);

4、添加Db.cs类

5、添加ConfigurationHelper.cs类

6、appsettings.json添加ConnectionStrings节

7、使用

DataTable dt = Db.Context("HYFW").Select<DataTable>("*")
    .From("table1")
    .QuerySingle();

猜你喜欢

转载自www.cnblogs.com/mellen/p/12547428.html
今日推荐