Will
Will

Reputation: 629

Naming Practice for domain object named class

I'm using a ORM and ran across a database table named Class. I've been naming the domain objects the same as their table name. So is Class a valid name for this object? I know it will compile but it doesn't seem like a good practice.

The table is refering to a versioned C# class.

Upvotes: 7

Views: 311

Answers (2)

Eric Petroelje
Eric Petroelje

Reputation: 60518

It'll compile, but personally I'd choose a different name to avoid any potential issues or confusion. Assuming you are talking about classes in the domain of education, maybe "Course" would be a good substitute?

Upvotes: 1

zadeveloper
zadeveloper

Reputation: 56

Its not good practice, and personally I would not do it, it compiles because in c# class != Class (its case sensitive)

class and all variations of class should be considered reserved words.

Upvotes: 4

Related Questions