{"id":16423822,"url":"https://github.com/rocherkong/bara","last_synced_at":"2025-10-26T22:31:47.023Z","repository":{"id":88533098,"uuid":"97185342","full_name":"RocherKong/Bara","owner":"RocherKong","description":"micro orm for .net cross-platform.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.","archived":false,"fork":false,"pushed_at":"2018-05-26T13:41:47.000Z","size":3774,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T00:51:05.508Z","etag":null,"topics":["dapper","dataaccess","database","dotfiles","mybatis","mysql","oracle","orm","sql"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RocherKong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-14T02:41:34.000Z","updated_at":"2020-08-25T03:24:57.000Z","dependencies_parsed_at":"2023-03-07T03:15:48.350Z","dependency_job_id":null,"html_url":"https://github.com/RocherKong/Bara","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RocherKong%2FBara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RocherKong%2FBara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RocherKong%2FBara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RocherKong%2FBara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RocherKong","download_url":"https://codeload.github.com/RocherKong/Bara/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238408494,"owners_count":19467100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dapper","dataaccess","database","dotfiles","mybatis","mysql","oracle","orm","sql"],"created_at":"2024-10-11T07:41:02.974Z","updated_at":"2025-10-26T22:31:46.354Z","avatar_url":"https://github.com/RocherKong.png","language":"C#","readme":"``` html\n\n    ____                     \n   |  _ \\                    \n   | |_) |  __ _  _ __  __ _ \n   |  _ \u003c  / _` || '__|/ _` |\n   | |_) || (_| || |  | (_| |\n   |____/  \\__,_||_|   \\__,_|\n                             \n                            \n```\n# Bara\n| Codacy | Appveyor | NuGet | Gitchat |\n|--------|----------|-------|---------|\n|[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2a3146f3f09246d3a1a25826189aa656)](https://www.codacy.com/app/kx.1990/Bara?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=RocherKong/Bara\u0026utm_campaign=badger)|[![Build status](https://ci.appveyor.com/api/projects/status/w20ms4cct4nyl5ar/branch/master?svg=true)](https://ci.appveyor.com/project/RocherKong/bara/branch/master)|  [![NuGet](https://img.shields.io/nuget/v/Bara.svg)](https://www.nuget.org/packages/Bara/)|[![Join the chat at https://gitter.im/Bara](https://badges.gitter.im/Bara.svg)](https://gitter.im/ORM-Bara/Lobby?utm_source=share-link\u0026utm_medium=link\u0026utm_campaign=share-link)|\n\n\nBara 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.\n## Features\n* Using Dapper for DataMapping and DataAccess. \n* Using Xml Config and Manage your sql like Ibatis.\n* Hot Update Sql when you changed your sql sentence.\n\n## Installing\nJust install the [Bara NuGet package](http://www.nuget.org/packages/Bara/):\n\n```\nPM\u003e Install-Package Bara\n```\n\nIf your want Bara Extension.(A collection of commonly used methods already included)\n```\nPM\u003e Install-Package Bara.DataAccess\n```\n\n## How To Use After Intalled\n### 1.Add **BaraMapConfig.xml** To Root Path.\n  \u003e * Config whether the config need Watched.It will be update when setting true.\n  \u003e * Config DataBase ConnectString  \n  \u003e * Split Writen DB and Read DB. Specify each Database Weight which indicate the Access probability.\n  \u003e * Specify the ParameterPrefix（MSSQL:'@',Mysql:'#'...）\n  \u003e * Config your Maps which your sql in.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003cBaraMapConfig xmlns=\"https://github.com/RocherKong/Bara/schemas/BaraMapConfig.xsd\"\u003e\n  \u003cSettings\n    IsWatchConfigFile=\"true\"\n  /\u003e\n  \u003cDatabase\u003e\n    \u003cDbProvider Name=\"SqlClientFactory\" ParameterPrefix=\"@\" Type=\"System.Data.SqlClient.SqlClientFactory,System.Data.SqlClient\"/\u003e\n    \u003cWrite Name=\"WriteDB\" ConnectionString=\"Data Source=.;database=GoodJob;uid=sa;pwd=App1234\"/\u003e\n    \u003cRead Name=\"ReadDB-0\" ConnectionString=\"Data Source=.;database=GoodJob;uid=sa;pwd=App1234\" Weight=\"50\"/\u003e\n    \u003cRead Name=\"ReadDB-1\" ConnectionString=\"Data Source=.;database=GoodJob;uid=sa;pwd=App1234\" Weight=\"50\"/\u003e\n  \u003c/Database\u003e\n  \u003cBaraMaps\u003e\n    \u003cBaraMap Path=\"Maps/\" Type=\"Directory\"\u003e\u003c/BaraMap\u003e\n  \u003c/BaraMaps\u003e\n\u003c/BaraMapConfig\u003e\n\nOracle:(Reference ODP Library From ./Doc/OracleDataProvider)\n\u003cDbProvider Name=\"OracleClientFactory\" ParameterPrefix=\":\" Type=\"Oracle.ManagedDataAccess.Client.OracleClientFactory,Oracle.ManagedDataAccess,Version=4.122.1.0,Culture=neutral, PublicKeyToken=89b483f429c47342\"/\u003e\n\u003cWrite 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)));\"/\u003e\n\n```\n\n### 2.Config BaraMap Xml Files(eg:**T_Test.xml** in Root-Folder Maps)\n\n### 3.Register To DI in Startup.cs\n```c#\n services.AddSingleton\u003cIBaraMapper\u003e(MapperContainer.Instance.GetBaraMapper());\n```\n\n### 4.Use Any Where\n#### 4.1 GetEntity\n```c#\nvar mapper = new BaraMapper();\nvar result = mapper.QuerySingle\u003cT_Test\u003e(new Core.Context.RequestContext\n  {\n      SqlId = \"GetEntity\",\n      Scope = \"T_Test\",\n      Request = new { Id = 1 }\n  });\n```\n\n#### 4.2 QueryList\n```c#\nvar list= mapper.Query\u003cT_Test\u003e(new Core.Context.RequestContext\n  {\n      SqlId=\"GetList\",\n      Scope=\"T_Test\",\n  });\n```\n\n#### 4.3 Add\n```c#\nint i = mapper.Execute(new Core.Context.RequestContext\n  {\n      Scope = \"T_Test\",\n      SqlId = \"Insert\",\n      Request = new { Id = 4, Name = \"Rocher4\" }\n  });\n```\n\n#### 4.4 Update\n```c#\nint i = mapper.Execute(new Core.Context.RequestContext\n  {\n      Scope = \"T_Test\",\n      SqlId = \"Update\",\n      Request = Entity\n  });\n```\n\n## Cache Config\n### Firstly You Need Config Cache in BaraMap file .\n```xml\n\u003cCaches\u003e\n    \u003cCache Id=\"T_Test.LruCache\" Type=\"Lru\"\u003e\n      \u003cParameter Key=\"CacheSize\" Value=\"100\"/\u003e\n      \u003cFlushInterval Hours=\"0\" Minutes=\"10\" Seconds=\"0\"/\u003e\n      \u003cFlushOnExecute Statement=\"T_Test.Insert\"/\u003e\n      \u003cFlushOnExecute Statement=\"T_Test.Update\"/\u003e\n    \u003c/Cache\u003e\n\u003c/Caches\u003e\n```\n### Secondly You Need Relate Cache to your statement.\n```xml\n\u003cStatement Id=\"QueryList\" Cache=\"T_Test.LruCache\"\u003e\n  SELECT Top 10 T.* From T_Test T With(NoLock)\n  \u003cInclude RefId=\"QueryParams\"/\u003e\n\u003c/Statement\u003e\n```\n### After config Metioned.The Same-Query after first Query Will fetch Data from Cache.Also it will dismiss after Insert or Update method executed. \n\n## Next Step \n* 0.Tags(Logic bit operator)\n* 1.Test\n* 2.Test Compare\n* 3.redis cache\n* 4.zookeeper(options)\n* 5.add Doc \n* 6.Release\n\n## Tips\n* Can DataAccess be more Simple?(Auto Generate dao Code for Mapping Method Name.)\n\n## Thanks\n[Ahoo-Wang/SmartSql](https://github.com/Ahoo-Wang/SmartSql/):\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocherkong%2Fbara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocherkong%2Fbara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocherkong%2Fbara/lists"}