WEF.Standard
1.0.3.7
See the version list below for details.
dotnet add package WEF.Standard --version 1.0.3.7
NuGet\Install-Package WEF.Standard -Version 1.0.3.7
<PackageReference Include="WEF.Standard" Version="1.0.3.7" />
paket add WEF.Standard --version 1.0.3.7
#r "nuget: WEF.Standard, 1.0.3.7"
// Install WEF.Standard as a Cake Addin #addin nuget:?package=WEF.Standard&version=1.0.3.7 // Install WEF.Standard as a Cake Tool #tool nuget:?package=WEF.Standard&version=1.0.3.7
WEF
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc.
WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。
WEF类似MEF上手简单,0学习成本。使用方便,按照sql书写习惯编写C#.NET代码
高性能,接近手写Sql
体积小(不到200kb,仅一个dll)
完美支持Sql Server(2000至最新版),MySql,Oracle,Access,Sqlite等数据库
支持大量Lambda表达式写法不需要像NHibernate的XML配置,不需要像MEF的各种数据库连接驱动
查询简例
db.Search<Area>(tableName) //Model.table1类通过<a href="https://github.com/yswenli/WEF/tree/master/WEF.ModelGenerator">WEF数据库工具生成</a>
.Select(d => new { d.id, d.price })
//Sql:SELECT id,price FROM table1
.Select<table2,table3>((a,b,c) => a.id, b.name, c.sex)
//Sql:SELECT table1.id, table2.name, table3.sex
.LeftJoin<table2>((a, b) => a.id == b.id)
//Sql:LEFT JOIN Table2 ON table1.id = table2.id
.Where(d => (d.id != 2 && d.name.In("com","net")) || d.sex != null)
//Sql:WHERE (id <> 2 AND name IN('com','net')) OR sex IS NOT NULL
.GroupBy(d => new { d.name, d.sex }) //Sql:GROUP BY name,sex
.OrderBy(d => new { d.createTime, d.name })
//Sql:ORDER BY createTime,name
.Having(d => d.name != '') //Sql:HAVING name <> ''
.Top(5) //取前5条数据
.Page(10, 2) //每页10条数据,取第2页
.ToList(); //默认返回List<table1>,也可自定义Map类.ToList<T>();
多where条件拼接
//Where条件拼接一:
var dbTestRepository = new DBTestRepository();
var where1 = new Where<DBTest>();
where1.And(d => d.Operator != "");
where1.And(d => d.Totallimit >= 0);
var list1 = dbTestRepository.Search()
.Where(where1)
.Page(1, 2)
.ToList();
//多表条件拼接
var where2 = new Where<table>();
where2.And(a => a.id == 1);
where2.And<table2>((a, b) => b.id == 2);
where2.And<table3>((a, c) => c.id == 3);
var list2 = new DBContext().Search<table>()
.InnerJoin<table2>((a, b) => a.id == b.aid)
.InnerJoin<table3>((a, c) => a.id == c.aid)
.Where(where1)
.ToList();
//上面的where还可以这样写:
var where3 = new Where<table>();
where3.And<table2, table3>((a, b, c) => a.id == 1 && b.id == 2 && c.id == 3);
执行sql
#region 无实体sql操作,自定义参数
var dt1 = new DBContext().FromSql("select * from tb_task where taskid=@taskID").AddInParameter("@taskID", System.Data.DbType.String, 200, "10B676E5BC852464DE0533C5610ACC53").ToFirst<DBTask>();
var count = new DBContext().Search<DBTask>().Where(b => b.Crc32.Avg() > 1).Count();
var dt2=new DBContext().ToList<DBTask>("select * from tb_task");
#endregion
聚合函数及Select
var count = giftopt.Search().Count(q => q.Supservicesku);
var sum = giftopt.Search().Select(b => b.Supporttype.Sum()).ToFirstDefault().Supporttype;
var avg = giftopt.Search().Select(b => b.Supporttype.Avg()).ToFirstDefault().Supporttype;
var select = giftopt.Search().LeftJoin<DBTask>((m, n) => m.Name == n.Name).Select<DBTask>((a, b) => new { a.Activename, b.Daylimit });
var select2 = giftopt.Search().LeftJoin2<DBTask>((m, n) => m.Name == n.Name).Select((a, b) => new { a.Activename, b.Daylimit });
//多表多关系的join
var giftopt = new DBGiftRepository(DatabaseType.SqlServer, "");
var select3 = giftopt.Search()
.Join<DBTask>((m, n) => m.Name == n.Name, JoinType.InnerJoin)
.Join<DBTask, DBUserPoint>((m, n) => m.Name == n.Uid, JoinType.LeftJoin)
.Select<DBTask>((a, b) => new { a.Activename, b.Daylimit });
//多表join并多表取值分页示例
Repository.Search().Join<DBNotificationSetting>((x, y) => x.SettingID == y.ID, WEF.Common.JoinType.LeftJoin)
.Where<DBNotificationSetting>((x, y) => x.ReceiverID == userId && x.IsDeleted != true && y.BusinessType == businessType && y.IsDeleted != true)
.Select<DBNotificationSetting>((x, y) => new
{
ID = x.ID,
Content = x.Content,
Created = x.Created,
UnRead = x.UnRead,
Key = y.Key,
BusinessType = y.BusinessType,
Type = y.Type,
Name = y.Name,
Icon = y.Icon,
BtnUrl = y.BtnUrl,
BtnText = y.BtnText,
Sender = x.Sender,
SenderName = x.SenderName,
SenderGender = x.SenderGender
}).ToPagedList<NotificationListItem>(pageIndex, pageSize, orderBy, asc);
//多表聚合分组示例
Repository
.Search()
.LeftJoin<DBNotificationSetting>((x, y) => x.SettingID == y.ID)
.Where(q => q.ReceiverID == userId && q.IsDeleted != true && q.UnRead == true)
.GroupBy<DBNotificationSetting>((x, y) => y.BusinessType)
.Select<DBNotificationSetting>((x, y) => new { BusinessType = y.BusinessType, Count = x.ID.Count() })
.ToList<UnReadCountResult>();
事务
var repository = new DBOcWarehouseAreaRepository(DatabaseType.MySql, cnnStr);
using (var tran = repository.CreateTransaction())
{
tran.Insert(area);
}
//或者
repository.CreateTransaction().TryCommit((tran)=>{
//todo
});
获取多表集合
var tuple = new DBArticleRepository(WEF.DatabaseType.SqlServer, "Data Source=localhost;Initial Catalog=template;User Id=testuser;Password=testuser")
.FromSql("select top 10 * from Article;select top 10 * from Comment")
.ToMultipleList<DBArticle, DBComment>();
List<DBArticle> articleList = tuple.Item1;
List<DBComment> commentList = tuple.Item2;
WEF数据库工具
WEF数据库工具是基于WEF的winform项目,可以快捷对数据库进行可视化操作的同时,高效生成基于WEF的ORM操作
<img src="https://github.com/yswenli/WEF/blob/master/1.png?raw=true">
<img src="https://github.com/yswenli/WEF/blob/master/2.png?raw=true">
<img src="https://github.com/yswenli/WEF/blob/master/3.png?raw=true">
<img src="https://github.com/yswenli/WEF/blob/master/4.png?raw=true">
<img src="https://github.com/yswenli/WEF/blob/master/5.png?raw=true">
<img src="https://github.com/yswenli/WEF/blob/master/6.png?raw=true">
<img src="https://github.com/yswenli/WEF/blob/master/7.png?raw=true">
WEF使用实例
/*
* 描述: 详细描述类能干什么
* 创建人:wenli
* 创建时间:2017/3/2 14:26:21
*/
/*
*修改人:wenli
*修改时间:2017/3/2 14:26:21
*修改内容:xxxxxxx
*/
using System;
using WEF.Expressions;
using WEF.Models;
namespace WEF.Test
{
class Programe
{
static void Main(string[] args)
{
Console.WriteLine("WEF使用实例");
Console.WriteLine("-----------------------------");
#region mysql
DBTaskRepository repository = new DBTaskRepository();
var task = repository.GetList(1, 10);
var taskModel = task.ConvertTo<DBTask, TaskModel>();
#endregion
#region 无实体sql操作,自定义参数
DBContext dbContext = new DBContext();
var dt1 = dbContext.FromSql("select * from tb_task where taskid=@taskID").AddInParameter("@taskID", System.Data.DbType.String, 200, "10B676E5BC852464DE0533C5610ACC53").ToFirst<DBTask>();
dbContext.Search<DBTask>().Sum();
//dbContext.ExecuteNonQuery("");
//dbContext.FromSql("").ToList<DBTask>();
#endregion
string result = string.Empty;
var entity = new Models.ArticleKind();
var entityRepository = new Models.ArticleKindRepository();
var pagedList = entityRepository.Search(entity).GetPagedList(1, 100, "ID", true);
do
{
Test2();
Console.WriteLine("输入R继续,其他键退出");
result = Console.ReadLine();
}
while (result.ToUpper() == "R");
}
static void Test2()
{
UserRepository ur = new UserRepository();
var e = ur.Search().Where(b => b.NickName == "adsfasdfasdf").First();
var ut = new User()
{
ID = Guid.NewGuid(),
ImUserID = "",
NickName = "张三三"
};
var r = ur.Insert(ut);
var count = ur.Search().Count();
ut.NickName = "李四四";
//ut.ConvertTo
r = ur.Update(ut);
#region search
var search = ur.Search().Where(b => b.NickName.Like("张*"));
search = search.Where(b => !string.IsNullOrEmpty(b.ImUserID));
var rlts = search.Page(1, 20).ToList();
#endregion
//批量操作
using (var batch = ur.DBContext.CreateBatch())
{
batch.Insert(ut);
}
var nut = ut.ConvertTo<User, SUser>();
var nut1 = ut.ConvertTo<User, SUser>();
var nnut = nut.ConvertTo<SUser, User>();
var ults = ur.GetList(1, 1000);
r = ur.Delete(ut);
#region tran
var tran = ur.DBContext.BeginTransaction();
tran.Insert<User>(ut);
var tb1 = new DBTaskRepository().GetList(1, 10);
//todo tb1
tran.Update<DBTask>(tb1);
ur.DBContext.CloseTransaction(tran);
#endregion
var dlts = ur.GetList(1, 10000);
ur.Deletes(dlts);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- System.Configuration.ConfigurationManager (>= 6.0.1)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Security.Permissions (>= 6.0.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on WEF.Standard:
Package | Downloads |
---|---|
WEF.Standard.Postgre
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc. WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。 |
|
WEF.Standard.MSSQL
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc. WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。 |
|
WEF.Standard.SQLite
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc. WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。 |
|
WEF.Standard.MySQL
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc. WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。 |
|
WEF.Standard.OLEDB
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc. WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.24.7.1 | 447 | 7/1/2024 |
6.24.4.24 | 378 | 4/22/2024 |
6.24.4.23 | 345 | 4/22/2024 |
6.24.4.22 | 364 | 4/22/2024 |
6.24.4.9 | 350 | 4/9/2024 |
6.23.11.29 | 543 | 11/29/2023 |
6.23.10.27 | 584 | 10/26/2023 |
6.23.10.26 | 375 | 10/26/2023 |
6.23.10.20 | 428 | 10/20/2023 |
6.23.9.25 | 476 | 9/25/2023 |
6.3.4.9 | 733 | 9/8/2023 |
6.3.4.8 | 768 | 8/8/2023 |
6.3.4.7 | 1,287 | 4/6/2023 |
6.3.4.6 | 738 | 4/6/2023 |
6.3.3.1 | 885 | 3/31/2023 |
6.3.2.2 | 1,037 | 3/22/2023 |
6.1.2.3 | 1,054 | 3/15/2023 |
6.1.2.2 | 1,012 | 3/13/2023 |
6.1.2.1 | 1,127 | 2/27/2023 |
6.1.1.9 | 1,101 | 2/24/2023 |
6.1.1.8 | 1,102 | 2/23/2023 |
6.1.1.7 | 1,108 | 2/22/2023 |
6.1.1.6 | 1,146 | 2/16/2023 |
2.3.5.1 | 1,191 | 2/15/2023 |
2.3.2.14 | 1,169 | 2/14/2023 |
2.2.5.6 | 1,216 | 2/13/2023 |
2.1.6.8 | 1,264 | 2/13/2023 |
2.1.6.6 | 1,195 | 2/9/2023 |
1.0.5.5 | 1,506 | 12/14/2022 |
1.0.5.4 | 1,477 | 12/14/2022 |
1.0.5.3 | 1,501 | 12/13/2022 |
1.0.5.2 | 1,606 | 11/29/2022 |
1.0.4.1 | 1,630 | 11/29/2022 |
1.0.3.9 | 1,685 | 11/28/2022 |
1.0.3.8 | 1,623 | 11/28/2022 |
1.0.3.7 | 1,705 | 11/16/2022 |
1.0.3.6 | 1,874 | 11/4/2022 |
1.0.3.5 | 2,060 | 10/26/2022 |
1.0.3.4 | 2,048 | 10/25/2022 |
1.0.3.3 | 2,098 | 10/24/2022 |
1.0.3.2 | 2,263 | 10/10/2022 |
1.0.3.1 | 2,338 | 10/10/2022 |
1.0.2.9 | 2,321 | 10/10/2022 |
1.0.2.8 | 2,196 | 10/9/2022 |
1.0.2.7 | 2,236 | 10/8/2022 |
1.0.2.6 | 2,236 | 9/28/2022 |
1.0.2.5 | 2,322 | 9/28/2022 |
1.0.2.4 | 2,290 | 9/28/2022 |
1.0.2.3 | 2,290 | 9/27/2022 |
1.0.2.2 | 2,255 | 9/26/2022 |
1.0.2.1 | 2,361 | 9/26/2022 |
1.0.1.9 | 2,354 | 9/14/2022 |
1.0.1.8 | 2,332 | 9/14/2022 |
1.0.1.7 | 2,326 | 9/8/2022 |
1.0.1.6 | 2,309 | 9/7/2022 |
1.0.1.5 | 2,292 | 9/7/2022 |
1.0.1.4 | 2,270 | 8/30/2022 |
1.0.1.3 | 2,331 | 8/30/2022 |
1.0.1.2 | 2,329 | 8/29/2022 |
1.0.1.1 | 2,285 | 8/26/2022 |
1.0.0.9 | 2,243 | 8/26/2022 |
1.0.0.8 | 2,337 | 8/24/2022 |
1.0.0.7 | 2,257 | 8/24/2022 |
1.0.0.6 | 2,245 | 8/24/2022 |
1.0.0.5 | 2,298 | 8/23/2022 |
1.0.0.4 | 2,152 | 8/15/2022 |
1.0.0.3 | 2,225 | 8/15/2022 |
1.0.0.2 | 2,254 | 8/11/2022 |
1.0.0.1 | 2,354 | 8/11/2022 |
WEF is based on the c # data entity framework supports MSQSqlServer, MySql, Orcalce, etc of conventional database and fast development, which integrates a large amount of data set under the development experience of tools, such as the Lambada without SQL query expression, add and delete, entity cloning, bulk and the parameters of the table, transaction, round of entities or stored procedures, SQL entities, etc.
WEF 是基于C#的数据实体框架,支持MSQSqlServer、MySql、Orcalce等等常规的数据库的快捷开发,其中集成了大量数据开发经验下的工具类集合,比如Lambada表达式查询、无sql的增删改查、实体克隆、批量、多表、事务、参数、SQL转实体或存储过程转实体等。