Gmail Calendar Documents Reader Web 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 Dec 8 2006, 8:55 am
From: "菌哥" <developer.vi...@gmail.com>
Date: Fri, 08 Dec 2006 05:55:54 -0800
Local: Fri, Dec 8 2006 8:55 am
Subject: 关于自连接
一个表,比如
ID,ParentID
我现在让顶级ID的ParentID为空,请问Save如何做?
问题1:在定义的时候如果定义成 int?
ID,这样生成的实体类是错误的
问题2:既然不能定义int?,那么ID怎么能够为空呢?

    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 Dec 8 2006, 9:26 am
From: Teddy <shijie...@gmail.com>
Date: Fri, 8 Dec 2006 22:26:19 +0800
Local: Fri, Dec 8 2006 9:26 am
Subject: Re: 关于自连接

ID可以定义成int,ParentID定义成int?就行了!

On 12/8/06, 菌哥 <developer.vi...@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 Dec 8 2006, 8:22 pm
From: "菌哥" <developer.vi...@gmail.com>
Date: Fri, 08 Dec 2006 17:22:24 -0800
Local: Fri, Dec 8 2006 8:22 pm
Subject: Re: 关于自连接
不是说了吗,是自连接,应该比如是这样的:
public interface Node : Entity  //部门
{
        [PrimaryKey] //自身主键
     int ID { get;  set;}

    [FkReverseQuery]
    Node ParentID { get; set; }

}

这时ParentID是类型还是Node,既然是Node,
那么其ID又是主键,怎么可能设置为int?呢

    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 Dec 8 2006, 9:48 pm
From: Teddy <shijie...@gmail.com>
Date: Sat, 9 Dec 2006 10:48:52 +0800
Local: Fri, Dec 8 2006 9:48 pm
Subject: Re: 关于自连接

*我说的就是自连接!!*

下面这样定义:

public interface Node : Entity  //部门
{
    [PrimaryKey] //自身主键
    int ID { get;  set;}

   [FkReverseQuery]
   Node ParentID { get; set; }

}

Parent对应的ParentID默认就是int?的。你不给它赋值他就是null。

Teddy

On 12/9/06, 菌哥 <developer.vi...@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