字符串格式:Data Source=localhost/orcl;User ID=system;Password=haha;
注意 .NET5 用户需要在API 或者WEB 顶目解决方案 Csproj 文件 加一行代码
<PropertyGroup> <TargetFramework>net5.0</TargetFramework> <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization> </PropertyGroup>
因为Oracle不支持自增列,所以我们需要使用序列来实现自增列
create sequence SEQ_ID minvalue 1 maxvalue 99999999 start with 1 increment by 1 nocache order;
public class OrderItem { //给序列赋值 现在我们就可以实现自增列 [SqlSugar.SugarColumn(IsPrimaryKey =true, OracleSequenceName = "SEQ_ID")] public int ItemId { get; set; } public int OrderId { get; set; } public decimal? Price { get; set; } [SqlSugar.SugarColumn(IsNullable = true)] public DateTime? CreateTime { get; set; } } //插入的时候ItemId 不需你去赋值,ORM会自已处理,也可以插成功后返回自增值
var p = new SugarParameter("@name", "张三"); p.IsRefCursor = true;
2016 © donet5.comApache Licence 2.0