代码拉取完成,页面将自动刷新
____
| _ \
| |_) | __ _ _ __ __ _
| _ < / _` || '__|/ _` |
| |_) || (_| || | | (_| |
|____/ \__,_||_| \__,_|
Codacy | Appveyor | NuGet | Gitchat |
---|---|---|---|
Bara is a .Net library for Orm. Bara provides quick access to DataBase. Also it is a cross-platform orm which is written by .net Standard version 1.4 . You Can use it on .net Framwork platform or .net Core platform with Any type DataBase which Dapper Support.
Just install the Bara NuGet package:
PM> Install-Package Bara
If your want Bara Extension.(A collection of commonly used methods already included)
PM> Install-Package Bara.DataAccess
- Config whether the config need Watched.It will be update when setting true.
- Config DataBase ConnectString
- Split Writen DB and Read DB. Specify each Database Weight which indicate the Access probability.
- Specify the ParameterPrefix(MSSQL:'@',Mysql:'#'...)
- Config your Maps which your sql in.
<?xml version="1.0" encoding="utf-8" ?>
<BaraMapConfig xmlns="https://github.com/RocherKong/Bara/schemas/BaraMapConfig.xsd">
<Settings
IsWatchConfigFile="true"
/>
<Database>
<DbProvider Name="SqlClientFactory" ParameterPrefix="@" Type="System.Data.SqlClient.SqlClientFactory,System.Data.SqlClient"/>
<Write Name="WriteDB" ConnectionString="Data Source=.;database=GoodJob;uid=sa;pwd=App1234"/>
<Read Name="ReadDB-0" ConnectionString="Data Source=.;database=GoodJob;uid=sa;pwd=App1234" Weight="50"/>
<Read Name="ReadDB-1" ConnectionString="Data Source=.;database=GoodJob;uid=sa;pwd=App1234" Weight="50"/>
</Database>
<BaraMaps>
<BaraMap Path="Maps/" Type="Directory"></BaraMap>
</BaraMaps>
</BaraMapConfig>
Oracle:(Reference ODP Library From ./Doc/OracleDataProvider)
<DbProvider Name="OracleClientFactory" ParameterPrefix=":" Type="Oracle.ManagedDataAccess.Client.OracleClientFactory,Oracle.ManagedDataAccess,Version=4.122.1.0,Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<Write Name="WriteDB" ConnectionString="User Id=User;Password=User;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)));"/>
services.AddSingleton<IBaraMapper>(MapperContainer.Instance.GetBaraMapper());
var mapper = new BaraMapper();
var result = mapper.QuerySingle<T_Test>(new Core.Context.RequestContext
{
SqlId = "GetEntity",
Scope = "T_Test",
Request = new { Id = 1 }
});
var list= mapper.Query<T_Test>(new Core.Context.RequestContext
{
SqlId="GetList",
Scope="T_Test",
});
int i = mapper.Execute(new Core.Context.RequestContext
{
Scope = "T_Test",
SqlId = "Insert",
Request = new { Id = 4, Name = "Rocher4" }
});
int i = mapper.Execute(new Core.Context.RequestContext
{
Scope = "T_Test",
SqlId = "Update",
Request = Entity
});
<Caches>
<Cache Id="T_Test.LruCache" Type="Lru">
<Parameter Key="CacheSize" Value="100"/>
<FlushInterval Hours="0" Minutes="10" Seconds="0"/>
<FlushOnExecute Statement="T_Test.Insert"/>
<FlushOnExecute Statement="T_Test.Update"/>
</Cache>
</Caches>
<Statement Id="QueryList" Cache="T_Test.LruCache">
SELECT Top 10 T.* From T_Test T With(NoLock)
<Include RefId="QueryParams"/>
</Statement>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。