Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

.NET aot orm, VB.NET/C# orm, Mysql/PostgreSQL/SqlServer/Oracle orm, Sqlite/Firebird/Clickhouse/DuckDB orm, 达梦/金仓/虚谷/翰高/高斯 orm, 神通 orm, 南大通用 orm, 国产 orm, TDengine orm, QuestDB orm, MsAccess orm.

License

NotificationsYou must be signed in to change notification settings

dotnetcore/FreeSql

Repository files navigation

FreeSql is a powerful O/RM component, supports .NET Core 2.1+, .NET Framework 4.0+, Xamarin, And AOT.

Member project of .NET Core CommunitynugetstatsGitHub license

English |中文

  • 🛠 Support CodeFirst data migration.
  • 💻 Support DbFirst import entity class from database, or useGeneration Tool.
  • ⛳ Support advanced type mapping, such as PostgreSQL array type, etc.
  • 🌲 Support expression functions, and customizable analysis.
  • 🏁 Support one-to-many and many-to-many navigation properties, include and lazy loading.
  • 📃 Support Read/Write separation, Splitting Table/Database, Global filters, Optimistic and pessimistic locker.
  • 🌳 Support MySql/SqlServer/PostgreSQL/Oracle/Sqlite/Firebird/达梦/人大金仓/南大通用/虚谷/神舟通用/翰高/ClickHouse/DuckDB/TDengine/QuestDB/MsAccess, etc.

QQ Groups:561616019(available)、4336577(full)、8578575(full)、52508226(full)

📚 Documentation

Get started  |  Select  |  Update  |  Insert  |  Delete  |  FAQ  
Expression  |  CodeFirst  |  DbFirst  |  Filters  |  AOP  
Repository  |  UnitOfWork  |  Dynamic Operations  |  ADO  
Read/Write  |  Splitting Table  |  Hide tech  |  Update Notes  

Please select a development mode:

Some open source projects that use FreeSql:

🚀 Quick start

dotnet add package FreeSql.Provider.Sqlite

staticIFreeSqlfsql=newFreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.Sqlite,@"Data Source=document.db").UseAutoSyncStructure(true)//automatically synchronize the entity structure to the database.Build();//be sure to define as singleton modeclassSong{[Column(IsIdentity=true)]publicintId{get;set;}publicstringTitle{get;set;}publicstringUrl{get;set;}publicDateTimeCreateTime{get;set;}publicICollection<Tag>Tags{get;set;}}classSong_tag{publicintSong_id{get;set;}publicSongSong{get;set;}publicintTag_id{get;set;}publicTagTag{get;set;}}classTag{[Column(IsIdentity=true)]publicintId{get;set;}publicstringName{get;set;}publicint?Parent_id{get;set;}publicTagParent{get;set;}publicICollection<Song>Songs{get;set;}publicICollection<Tag>Tags{get;set;}}

🔎 Query

//OneToOne、ManyToOnefsql.Select<Tag>().Where(a=>a.Parent.Parent.Name=="English").ToList();//OneToManyfsql.Select<Tag>().IncludeMany(a=>a.Tags, then=>then.Where(sub=>sub.Name=="foo")).ToList();//ManyToManyfsql.Select<Song>().IncludeMany(a=>a.Tags, then=>then.Where(sub=>sub.Name=="foo")).Where(s=>s.Tags.Any(t=>t.Name=="Chinese")).ToList();//Otherfsql.Select<YourType>().Where(a=>a.IsDelete==0).WhereIf(keyword!=null, a=>a.UserName.Contains(keyword)).WhereIf(role_id>0, a=>a.RoleId==role_id).Where(a=>a.Nodes.Any(t=>t.Parent.Id==t.UserId)).Count(outvartotal).Page(page,size).OrderByDescending(a=>a.Id).ToList()

More..

fsql.Select<Song>().Where(a=>new[]{1,2,3}.Contains(a.Id)).ToList();fsql.Select<Song>().Where(a=>a.CreateTime.Date==DateTime.Today).ToList();fsql.Select<Song>().OrderBy(a=>Guid.NewGuid()).Limit(10).ToList();fsql.Select<Song>().ToList(a=>new{a.Id,Tags=fsql.Select<Tag>().ToList(),SongTags=fsql.Select<SongTag>().Where(b=>b.TopicId==a.Id).ToList()});

More..

🚁 Repository

dotnet add package FreeSql.Repository

[Transactional]publicvoidAdd(){varrepo=ioc.GetService<BaseRepository<Tag>>();repo.DbContextOptions.EnableCascadeSave=true;varitem=newTag{Name="testaddsublist",Tags=new[]{newTag{Name="sub1"},newTag{Name="sub2"}}};repo.Insert(item);}

Reference:UseTransactionalAttribute andUnitOfWorkManager in ASP.NET Core to Achieve theMultiple Transaction Propagation.

💪 Performance

FreeSql Query & Dapper Query

Elapsed: 00:00:00.6733199; Query Entity Counts: 131072; ORM: DapperElapsed: 00:00:00.4554230; Query Tuple Counts: 131072; ORM: DapperElapsed: 00:00:00.6846146; Query Dynamic Counts: 131072; ORM: DapperElapsed: 00:00:00.6818111; Query Entity Counts: 131072; ORM: FreeSql*Elapsed: 00:00:00.6060042; Query Tuple Counts: 131072; ORM: FreeSql*Elapsed: 00:00:00.4211323; Query ToList<Tuple> Counts: 131072; ORM: FreeSql*Elapsed: 00:00:01.0236285; Query Dynamic Counts: 131072; ORM: FreeSql*

FreeSql ToList & Dapper Query

Elapsed: 00:00:00.6707125; ToList Entity Counts: 131072; ORM: FreeSql*Elapsed: 00:00:00.6495301; Query Entity Counts: 131072; ORM: Dapper

More..

👯 Contributors

And other friends who made important suggestions for this project, they include:

systemhejiyong,LambertW,mypeng1985,stulzq,movingsam,ALer-R,zouql,深圳|凉茶,densen2014,LiaoLiaoWuJu,hd2y,tky753,feijie999,constantine,JohnZhou2020,mafeng8,VicBilibily,Soar,quzhen91,homejun,d4ilys etc.

💕 Donation

L*y 58元、花花 88元、麦兜很乖 50元、网络来者 2000元、John 99.99元、alex 666元、bacongao 36元、无名 100元、Eternity 188元、无名 10元、⌒.Helper~..oO 66元、习惯与被习惯 100元、无名 100元、蔡易喋 88.88元、中讯科技 1000元、Good Good Work 24元、Nothing 100元、兰州天擎赵 500元、哈利路亚 300元、无名 100元、蛰伏 99.99元、TCYM 66.66元、MOTA 5元、LDZXG 30元、Near 30元、建爽 66元、无名 200元、LambertWu 100元、无名 18.88元、乌龙 50元、无名 100元、陳怼怼 66.66元、陳怼怼 66.66元、丁淮 100元、李伟坚-Excel催化剂 100元、白狐 6.66元、她微笑的脸y 30元、Eternity²º²¹ 588元、夜归柴门 88元、蔡易喋 666.66元、*礼 10元、litrpa 88元、Alax CHOW 200元、Daily 66元、k*t 66元、蓝 100元、*菜 10元、生命如歌 1000元、山鸡 88元、平凡 100元、大树 1000元、软软的毛毛虫 66.66元、问卷星 2000元、与你无关 5000元

Thank you for your donation

🗄 License

MIT

About

.NET aot orm, VB.NET/C# orm, Mysql/PostgreSQL/SqlServer/Oracle orm, Sqlite/Firebird/Clickhouse/DuckDB orm, 达梦/金仓/虚谷/翰高/高斯 orm, 神通 orm, 南大通用 orm, 国产 orm, TDengine orm, QuestDB orm, MsAccess orm.

Topics

Resources

License

Stars

Watchers

Forks

Contributors51

Languages


[8]ページ先頭

©2009-2025 Movatter.jp