Why can't you have a the same property name as the entity that it is in?

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
ashlar64
Posts: 75
Joined: Thu 04 May 2006 18:56

Why can't you have a the same property name as the entity that it is in?

Post by ashlar64 » Fri 02 Jan 2015 17:34

Hello,

I am wondering why LinqConnect doesn't allow a property name of a entity to be the same as a entity's class name?

Or is there a way to allow this?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Why can't you have a the same property name as the entity that it is in?

Post by MariiaI » Mon 05 Jan 2015 13:38

Although it is possible to create property with the same name as the class in Visual Basic, it is not a very good practice. For this reason, the C# language does not allow to do it, and many editors, too (such as the standard ADO.NET Entity Data Model Designer). Thus, in order to avoid the problems with sharing models between different projects and to maintain best practices we perform this validation, too.

ashlar64
Posts: 75
Joined: Thu 04 May 2006 18:56

Re: Why can't you have a the same property name as the entity that it is in?

Post by ashlar64 » Mon 05 Jan 2015 15:26

Well I totally agree with you....ideally I would like to do that. But when dealing with external code / or equipment sometimes you have to do things certain ways that are not exactly the most ideal ways to do things.

Ok - so it sounds like there is no setting that would allow this.

If not that is fine I will just have to use the custom code I am currently using in that case...

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Why can't you have a the same property name as the entity that it is in?

Post by MariiaI » Tue 06 Jan 2015 06:05

ashlar64 wrote:Ok - so it sounds like there is no setting that would allow this.
If not that is fine I will just have to use the custom code I am currently using in that case...
Yes, unfortunately, there is no such setting in LinqConnect.
If you have any further questions, feel free to contact us.

Post Reply