SmartSql For Asp.Net Core 最佳实践
常規(guī)操作
安裝 SmartSql
Install-Package SmartSql安裝 SmartSql.DIExtension
Install-Package SmartSql.DIExtension配置SmartSqlConfig.xml
寫庫(Write)必選 唯一節(jié)點(diǎn)
讀庫(Read)可選 多節(jié)點(diǎn)配置
Postgresql
Postgresql 客戶端?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
配置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)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在 Windows 上可以用 Docke
- 下一篇: asp.net ajax控件工具集 Au