Simple.Data wiki 阅读 2

本文介绍了Simple.Data中动态查询的方法,包括使用Find和FindAllBy系列函数进行数据检索。通过这些函数可以灵活地构建复杂的查询条件,并支持LINQ风格的表达式。此外,还展示了如何利用这些方法执行更高级的操作,例如联表查询。

 

Find and FindAll

More complex criteria can be expressed using the Find and FindAll methods, which accept an expression, kind of similar to LINQ. Except not LINQ.

Simple.Data:

db.Users.Find(db.Users.JoinDate <= “2010-01-01”)

SQL:

SELECT * FROM [Users] WHERE [Users].[JoinDate] <= @p1

Criteria can be combined using the && and || operators. Parentheses for altering grouping of expressions are supported:

Simple.Data:

db.Users.Find(db.Users.Active.Like(“Y”) && db.Users.JoinDate <= “2010-01-01”)

SQL:

SELECT * FROM [Users] WHERE ([Users].[Active] LIKE @p1 AND [Users].[JoinDate]) <= @p2
Supported operators for Find
  • ==
  • !=
  • <
  • <=
  • >
  • >=

 

 

Joins

If you have referential integrity set up, Simple.Data will automatically apply joins for Find operations which use sub-object style criteria. Like this:

Simple.Data:

db.Customers.Find(db.Customers.Invoices.Paid == “N”)

SQL:

SELECT [Customers].* FROM [Customers] 
JOIN [Invoices] ON [Customers].[CustomerId] = [Invoices].[CustomerId]
WHERE [Invoices].[Paid] = @p1

        

Getting all the data

You can use the All method to return all the data from a table:

Simple.Data:

db.Users.All()

SQL:

SELECT * FROM Users

Like FindAllBy it returns an IEnumerable<dynamic>.

 

posted on 2012-04-29 08:54 pieux 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/pieux/archive/2012/04/29/2475915.html

### SimpleChart Toolkit 控件概述 SimpleChart 是一款用于 Android 平台的数据可视化组件库,支持多种图表类型的绘制。该库允许开发者轻松创建柱状图、折线图、饼图等多种常见统计图表[^5]。 #### 主要特性 - 支持自定义样式配置 - 提供丰富的交互功能 - 高性能渲染机制 - 易于集成到现有项目中 #### 安装与依赖管理 为了使用 SimpleChart,在项目的 `build.gradle` 文件内添加如下依赖声明: ```gradle dependencies { implementation 'com.github.lecho:hellocharts-library:<latest_version>' } ``` 请注意替换 `<latest_version>` 为实际版本号。可以通过访问 [GitHub Releases](https://github.com/lecho/hellocharts-android/releases) 获取最新发布信息[^5]。 #### 基本用法示例 下面是一个简单的例子来展示如何初始化并显示一条折线图: ```java // 创建数据集 List<PointValue> values = new ArrayList<>(); for (int i = 0; i < count; ++i) { values.add(new PointValue(i, random.nextInt(10))); } Line line = new Line(values); line.setColor(Color.parseColor("#FFCD41")); List<Line> lines = new ArrayList<>(); lines.add(line); // 设置数据源 LineChartData data = new LineChartData(); data.setLines(lines); // 应用至视图 mLineChartView.setInteractive(true); mLineChartView.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL); mLineChartView.setMaxZoom((float) 2);//最大缩放比例 mLineChartView.setLineChartData(data); ``` 此代码片段展示了如何构建一个包含随机数值点的折线,并将其应用到名为 `mLineChartView` 的图表视图上[^5]。 #### 进一步学习资源 对于更深入的学习和探索,建议查阅官方 GitHub 页面以及 Wiki 文档中的更多案例研究和技术细节[^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值