Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
问几个问题
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
锦瑟  
View profile   Translate to Translated (View Original)
 More options Nov 19 2006, 8:37 am
From: "锦瑟" <hgamez...@gmail.com>
Date: Sun, 19 Nov 2006 05:37:22 -0800
Local: Sun, Nov 19 2006 8:37 am
Subject: 问几个问题
实际开发中经常碰到这样的问题,请问NBear是否提供了解决方案:

1。要取出某表中符合特定条件的记录,例如某int型的字段大于10的记录。或者某字段in
(1,2,3)的记录(或not
in,between等)。还有取出前n条,如top 10之类。

2。对多表查询,NBear是如何处理的?如下表
字段A  字段B  字段C
1          2           aaa

其中A和B来自一个表,C来自另个表。首先如何将这个列表呈现出来?如何将2个实体的结果拼起来?是否一定要用视图?

3。对于日期查询,要查找某DateTime类型的字段介于2个时间之间的,怎么处理?

4。是否支持存储过程级的分页?这个对性能影响很大。

5。是否支持事务?比如更新一个主表,再更新其子表,那么这2个操作应在一个事务里完成,默认的Containd=true的更新是放在事务里的吗?如果不是, 能么能否提供一个调用事务的例子?

6。关于批量更新,如我要把主表里主键为1的那条记录,它在子表中的所有行的某个字段全部更新一下,如何处理?

暂时就这些,想到新的再提。


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Teddy  
View profile   Translate to Translated (View Original)
 More options Nov 19 2006, 8:53 am
From: Teddy <shijie...@gmail.com>
Date: Sun, 19 Nov 2006 21:53:49 +0800
Local: Sun, Nov 19 2006 8:53 am
Subject: Re: 问几个问题

1、支持,对用常用的查询,NBear提供了强类型查询语法,对于复杂查询,NBear也提供直接使用sql的查询条件,并且在同一个查询中,强类型条件和sq l条件可以组合混用,你提到的这些都有办法非常方便的支持。

2、对于这类复杂查询,以及分组查询等,需要建视图来支持。

3、对于日期范围,可以以自然的方式处理,比如查询条件可以类似:Article._.PostTime > DateTime.Parse("2006-1-1")
& Article._.PostTime < DateTime.Parse("2006-1-5")。

4、默认的分页并不使用存储过程实现,但是,NBear支持读取存储过程,返回强类型实体,所以对于高性能查询要求,可以使用自定义的存储过程来实现。

5、是的,所有的级联更新全都包含于事务,并且,在数据库中,所有有关联关系的表都是自动生成了依赖约束的,即使通过外部的程序读写数据库,也不会破坏数据完整 性。

6、完全支持,Gateway.BatchUpdate和BatchDelete方法提供了强类型的批量更新和删除支持。以批量更新为例,查询类似:
gateway.BatchUpdate<User>(new PropertyItem[] { User._.Status }, new object[]
{ UserStatus.Deleted }, User._.GroupID == 1);

Teddy

On 11/19/06, 锦瑟 <hgamez...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
锦瑟  
View profile   Translate to Translated (View Original)
 More options Nov 20 2006, 10:01 pm
From: "锦瑟" <hgamez...@gmail.com>
Date: Mon, 20 Nov 2006 19:01:44 -0800
Local: Mon, Nov 20 2006 10:01 pm
Subject: Re: 问几个问题
感谢回复。

1。级联更新你是做在一个事务里了,那么我如果还有自己的其他需求要将几个操作在一个事务里完成,应该怎么写呢,有没有例子?

2。最后那个BatchUpdate的更新语法我不是很明白,有没有详细点的教程。


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Teddy  
View profile   Translate to Translated (View Original)
 More options Nov 20 2006, 10:07 pm
From: Teddy <shijie...@gmail.com>
Date: Tue, 21 Nov 2006 11:07:17 +0800
Local: Mon, Nov 20 2006 10:07 pm
Subject: Re: 问几个问题

1、对于任意的写操作,都可以使用TransactionScope或者带DbTrancastion参数的写操作的重载版本来包含到一个事务中。
操作方法和标准的ADO.Net的事务处理是一致的。

2、这个语法的意思就是:第一个参数指定哪些列要更新,第二个参数指定第一个参数指定的要更新的列的更新数据,第三个参数表示被更新的记录的条件。

Teddy

On 11/21/06, 锦瑟 <hgamez...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google