日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > asp.net >内容正文

asp.net

SmartSql For Asp.Net Core 最佳实践

發(fā)布時(shí)間:2023/12/4 asp.net 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SmartSql For Asp.Net Core 最佳实践 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

常規(guī)操作

安裝 SmartSql

Install-Package SmartSql

安裝 SmartSql.DIExtension

Install-Package SmartSql.DIExtension

配置SmartSqlConfig.xml

  • 寫庫(Write)必選 唯一節(jié)點(diǎn)

  • 讀庫(Read)可選 多節(jié)點(diǎn)配置

    Postgresql

  • Postgresql 客戶端?Npgsql

Install-Package Npgsql

<?xml version="1.0" encoding="utf-8" ?>
<SmartSqlMapConfig xmlns="http://SmartSql.net/schemas/SmartSqlMapConfig.xsd"> ?<Settings ? ?IsWatchConfigFile="true" ?/> ?<Database> ? ?<!--ParameterPrefix:[SqlServer:@ | MySQL:? |Oracle::|Postgresql:@] --> ? ?<DbProvider Name="SqlClientFactory" ParameterPrefix="@" Type="Npgsql.NpgsqlFactory,Npgsql"/> ? ?<Write Name="WriteDB" ConnectionString="Server=localhost;Port=5432;User Id=postgres;Password=Rocher2016; Database=SmartSqlDB;"/> ?</Database> ?<SmartSqlMaps> ? ?<SmartSqlMap Path="Maps/" Type="Directory"></SmartSqlMap> ?</SmartSqlMaps>
</SmartSqlMapConfig>

MYSQL

  • 安裝mysql 客戶端?Mysql.Data

Install-Package Mysql.Data
  • 配置SmartSqlMapConfig.xml

MSSQL

注入依賴

services.AddSmartSql();services.AddRepositoryFactory();services.AddRepositoryFromAssembly((options) =>{options.AssemblyString = "SmartSql.Starter.Repository";});

定義倉儲(chǔ)接口

盡情享用

作者:Ahoo Wang (阿虎)

Github:?https://github.com/Ahoo-Wang/

SmartSql(高性能、高生產(chǎn)力,超輕量級(jí)的ORM!):?https://github.com/Ahoo-Wang/SmartSql

SmartCode(不只是代碼生成器!):?https://github.com/Ahoo-Wang/SmartCode

相關(guān)文章:

  • 如何通過本地化事件正確實(shí)現(xiàn)微服務(wù)內(nèi)部強(qiáng)一致性,事件總線跨微服務(wù)間最終一致性

  • SmartCode 正式開源,不只是代碼生成器!

原文地址:https://www.cnblogs.com/Ahoo-Wang/p/SmartSql-best-practice.html

.NET社區(qū)新聞,深度好文,歡迎訪問公眾號(hào)文章匯總 http://www.csharpkit.com

總結(jié)

以上是生活随笔為你收集整理的SmartSql For Asp.Net Core 最佳实践的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。