ID or Id?

S

shapper

Hello,

I have am using SQL Server and Entity Framework to create my Entities.

On my SQL code I have:

create table Assets
(
ID uniqueidentifier not null rowguidcol
constraint PK_Asset primary key clustered,
Content nvarchar(max) not null
) -- Assets

And my Entity becomes:

public class Asset {
public Guid ID { get; set; }
public String Content { get; set; }
}

When should I use ID or Id?

To extend this discussion:

public Asset GetAssetByID(Guid id)

Or GetAssetById?

I also found the following:
http://msdn.microsoft.com/en-us/library/ms229043.aspx

I get the impression that it should be ID ... But then in Pascal it
should be Id ...

In .NET Microsoft uses GridView1.ClientID.

I am a little bit confused. What do you usually do?

NOTE: The code I write in this post is exactly as I am using at the
moment.

Thanks,
Miguel
 
S

sloan

Please do not multi post.

sqlserver.programming has this same post.

You can cross post (to a ~few germane newsgrousp), but please don't multi
post.
 
P

proxyuser

ID is kind of a special case. It's an abbreviation, not an acronym, so
you'd think it would be Id. But for one thing, usually abbreviations are
pronounced like the part of the word it spells. For example, "conn" for
connection, "tran" for transaction. But everyone pronounces "Id" as "eye
dee". So writing "Id" doesn't match the way people pronounce it.

Also, there is actually a word "id"
http://en.wikipedia.org/wiki/Id,_ego,_and_super-ego

For those who know that word, it's a little annoying to hear "Id" pronounced
like "id".

But then, no one ever pronounces Guid as "goo eye dee", it's always "goo id"
or "gwid". So go figure....
 
B

Brian Gideon

Hello,

I have am using SQL Server and Entity Framework to create my Entities.

On my SQL code I have:

create table Assets
(
  ID uniqueidentifier not null rowguidcol
    constraint PK_Asset primary key clustered,
  Content nvarchar(max) not null
) -- Assets

And my Entity becomes:

public class Asset {
  public Guid ID { get; set; }
  public String Content { get; set; }

}

When should I use ID or Id?

To extend this discussion:

  public Asset GetAssetByID(Guid id)

Or GetAssetById?

I also found the following:http://msdn.microsoft.com/en-us/library/ms229043.aspx

I get the impression that it should be ID ... But then in Pascal it
should be Id ...

In .NET Microsoft uses GridView1.ClientID.

I am a little bit confused. What do you usually do?

NOTE: The code I write in this post is exactly as I am using at the
moment.

Thanks,
Miguel

I believe the .NET naming guidelines say make the first letter upper
case and the remain letters lower case even when using acronyms unless
the acronym is only 2 letters in which case make both upper case.
But, personally I don't really care either way regarding the special 2
letter case. In fact, I think I've done it both ways myself.
 
S

shapper

Please do not multi post.

I posted on SQL group because this has something to do with SQL since
my ID's comes from SQL and I would like to have coherent ID or id
across my SQL and C# code.
I wanted to ear SQL people opinion to ... And not only C# people.

I understand that many people, like me, use both groups but when
posting a message I see it as two different groups.

If you notest on the other post I removed part of the code. The one
referring to the method.
I left only the Entity code so people in SQL group understands that I
am mapping the SQL tables to C# using EF.

In this case, is multi posting so wrong?
I really didn't have that intention. I really wanted to ear both
parts.

With no disrespect.

Thanks,
Miguel
 
S

shapper

I believe the .NET naming guidelines say make the first letter upper
case and the remain letters lower case even when using acronyms unless
the acronym is only 2 letters in which case make both upper case.

Yes, that was my interpretation: ID and OK were the ones that should
(or could ???) use it.
Because if it is could then Id and Ok is fine to.

I created this thread because I have been following some C# code for
creating Repository patterns and each people uses different.

To be honest I don't know which way to go.

I have used both but I would like to take a decision and be consistent
because that is important.
So I just wanted to start being consisting using the more correct
option. :)
 
S

sloan

The general rule of thumb is to cross-post.

The biggest reason for NOT multi-post is wasting people's time.

If someone answers the question in one newsgroup completely, but in another
newsgroup it remains "empty" (no feedback), someone might come along and
dedicate 10,20, 30 minutes (or 10,20,30 seconds, it doesn't really matter)
to a question that already has been completely answered in another
newsgroup.

While this was a quick-hit question, some people who help spend their time
to help. And sometimes the responses take a longer amount of time.

...........

If I called you (as a friend) and said "I just got a flat tire in the
interstate, can you come help me fix it?" and you drove 20 minutes to get to
him, and then when you get there, you see that I called ~another~ friend and
they ~already~ had the tire fixed........you'd be like "Hey, why did you
call two people to help you?" or (at the least) "Could you have not called
me and said you already had someone helping you?"

Most people (if they had been the person with the flat tire) would be like
"I'm apologize that didn't call you back, and I apologize that I wasted your
time"

In a newsgroup because we don't really have personal relationships with
people, we don't think that much about wasting other people's time.
But the usual result of multi-posting is in fact, wasting someone's time,
because alot of times it is already addressed.

The other issue is future googler's (bing'ers) out there. You are searching
for something, and then instead of it being a single thread, its scattered
over several threads.

My favorite flavor of these is "Oh, nevermind, I found the answer", and then
the person doesn't post the answer. So they are "takers" instead of
"givers".
So if you find your own answer, then post your own answer. Then future
searchers will find a solution, not a dead end to the thread.

.......

If your case I would have made the second posting ( a seperate post ), but
maybe clarified it with "I'm posting this in a different newsgroup on
purpose, because I want two different perspectives".

The majority of time, multi-posts are what I described, wasting someone's
time.

But I see your point. Again, I would have posted the "I'm doing this on
purpose".

...............................


http://en.wikipedia.org/wiki/Ethic_of_reciprocity
Ethic of reciprocity

I would also distinquish that there is a difference between
"If you don't want it done to you, don't do it to others"
vs
"So whatever you wish that others would do to you, do also to them"
The first one is simple omission. The second one is much "deeper" because
if involves the commission of acts.






Please do not multi post.

I posted on SQL group because this has something to do with SQL since
my ID's comes from SQL and I would like to have coherent ID or id
across my SQL and C# code.
I wanted to ear SQL people opinion to ... And not only C# people.

I understand that many people, like me, use both groups but when
posting a message I see it as two different groups.

If you notest on the other post I removed part of the code. The one
referring to the method.
I left only the Entity code so people in SQL group understands that I
am mapping the SQL tables to C# using EF.

In this case, is multi posting so wrong?
I really didn't have that intention. I really wanted to ear both
parts.

With no disrespect.

Thanks,
Miguel
 
S

shapper

If your case I would have made the second posting ( a seperate post ), but
maybe clarified it with "I'm posting this in a different newsgroup on
purpose, because I want two different perspectives".

The majority of time, multi-posts are what I described, wasting someone's
time.

But I see your point.  Again, I would have posted the "I'm doing this on
purpose".

Thank you Sloan. I will do that if such a situation comes up. It
sounds reasonable.

I wasn't trying to make anyone loose time.
I really though that it was ok in this case because I was expecting to
receive answers related to the C# part on the C# group and related to
the SQL part in the SQL group.
I just posted a little bit of both so people could have a better idea
of what I was doing since my SQL was related to my C# code through
Entity Framework.

Thanks,
Miguel
 
S

sloan

Right.

Your post is the exception to the general rule. ((<<And for what it is
worth, I agree its an exception now that you've explained it)

As long as you understand that, than that's cool.


Carry on!



If your case I would have made the second posting ( a seperate post ), but
maybe clarified it with "I'm posting this in a different newsgroup on
purpose, because I want two different perspectives".

The majority of time, multi-posts are what I described, wasting someone's
time.

But I see your point. Again, I would have posted the "I'm doing this on
purpose".

Thank you Sloan. I will do that if such a situation comes up. It
sounds reasonable.

I wasn't trying to make anyone loose time.
I really though that it was ok in this case because I was expecting to
receive answers related to the C# part on the C# group and related to
the SQL part in the SQL group.
I just posted a little bit of both so people could have a better idea
of what I was doing since my SQL was related to my C# code through
Entity Framework.

Thanks,
Miguel
 
G

Göran Andersson

shapper said:
When should I use ID or Id?

One could think that the framework should be consistent in naming, but a
quick look in Reflector revealed:

PlatformID
ObjectIDGenerator
DispIdAttribute
ProgIdAttribute
SoapId
CommandID
ControlIDConverter
IDReferencePropertyAttribute
SecurityIDType

Personally I use Id, and have since the 20th century...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top