参考

参考代码

sqlserver数据库:①Nuget: Microsoft.EntityFrameworkCore.SqlServer

ORACLE数据库:①Nuget: Oracle.EntityFrameworkCore

以oracle为列:

新建DataDBContext连接类

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; namespace WebApplication2
{
public class DataDBContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseOracle(@"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.113)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)));Persist Security Info=True;User ID=zhzepp;Password=citms", b => b.UseOracleSQLCompatibility(""));
} public DbSet<ASSETSEntity> OrderInfos { get; set; }//实体 static public void test()
{
using (var db = new DataDBContext())
{
var count = db.OrderInfos.Where(x => x.ASSETSID != null).ToList(); }
}
}
}

实体类

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks; namespace WebApplication2
{
[Table("ASSETS")]
public class ASSETSEntity
{
/// <summary>
/// 主键
/// </summary>
[Key]
public string ASSETSID { get; set; }
/// <summary>
/// TAGS
/// </summary>
[Column("TAGS"), MaxLength()]
public string TAGS { get; set; }
}
}

在Startup.cs里面

最新文章

  1. Android带边框表格的实现
  2. VB类模块中属性的参数——VBA中Range对象的Value属性和Value2属性的一点区别
  3. windbg sos加载相关
  4. keepalived初探
  5. HTTP Post Request using Apache Commons
  6. Mysql 锁粒度
  7. ssma for oracle
  8. Android安卓安全审计mobiseclab
  9. FileReader和FileInputStream的区别
  10. C#基础 运算符
  11. (原创)列主元Gauss消去法的通用程序
  12. KNN算法基本实例
  13. springboot:Java模板引擎Thymeleaf介绍
  14. 面向对象编程其实很简单——Python 面向对象(初级篇)
  15. C++ code:低级编程
  16. Java--TestNG
  17. asp.net webapi 自托管插件式服务(转)
  18. Spring Boot 应用系列 1 -- Spring Boot 2 整合Spring Data JPA和Druid,双数据源
  19. MySQL3:存储过程和函数
  20. LG3781 [SDOI2017]切树游戏

热门文章

  1. mysql事务管理及spring声明式事务中主动异常抛出使数据库回滚
  2. 10,html全局属性有哪些
  3. dropna fillna
  4. next_permutation的使用-Hdu1027
  5. 匹配 $gdinfo 中的数字
  6. 手把手教你使用Hexo+GitHub搭建自己的个人博客网站
  7. 201771010135杨蓉庆 《面向对象程序设计(java)》第三周学习总结
  8. 如何使用charles对Android Https进行抓包
  9. 基于Facebook开源框架SocketRocket的即时通讯
  10. cmake 环境安装与使用