I try to read C# ECMA to find out what an entity
is but failed.
Is this a instance of class?
Or types+members?
Or any single word in the code that shows no red wavy line under it?
Entity is a semantic i.e. relating to meaning in language or logic. An entity is something that exists in itself, actually or potentially, concretely or abstractly, physically or not. It needs not be of material existence.
An entity usually refers to something, anything really, that has a unique and separate existence. In software development this word is almost only used to denote that one instance is different from another instance and they are independent of each other.
A class, on the other hand, defines or contains the definition of an object. Once that object is constructed based on the definition, then you get your instance or object instance.
Hope it helps ;)
In C# term entity
is commonly related to database representation of the table and should contain an Id attribute.
actually or potentially, concretely or abstractly, physically or not.
is more confusing. –
Cubature Generally, an entity is a unit of existence, an existing or real thing. Something that can have properties ascribed to it that distinguishes it from another unit with similar characteristics.
I have a table and you have a table. If I describe my table in enough detail then at some point it will be possible to distinguish my table from yours.
In object-oriented programming an entity corresponds to an object instance. In data modelling it corresponds to a unit of data rather than something necessarily having a physical presence.
I think they are using it in it's broadest meaning
Entity: something having real or distinct existence; a thing, esp when considered as independent of other things
So an Entity can be instance of class and types+members
Depending on the context.
Lets say you are talking about class definitions if two classes can be "considered as independent"(having different namespaces) they will call it an Entity.
If you are talking about some sort of business logic you might use the "Entity" word for all objects that have the same Id value stored in the in memory property or Database.
Essentially if you can have a function areTheSame(x,y)=>[true,false]
and the result of the function for all posible x and y can be false you can call that x or y an entity.
An entity in a broader setting is just a "something" that exists.
In the C# ECMA an entity is a placeholder for something that you refer to.
This could be a an instance if you refer to an entity created from a class. Or for example the following section defined a scope the following way:
The scope of a name is the region of program text within which it is possible to refer to the entity declared by the name without qualification of the name.
So to acces a given something (an entity), you need to reference the scope to refer to it. This could be a class, an instance, a static method or else.
Practically speaking and within the realm of CRUD web applications, an entity is simply a class representation of a database table.
Suppose you have a web application consisting of a database with three tables, each having a number of attributes:
Table 1: User
- Name
- Surname
- ID_Number
Table 2: Address
- Residential_address
- Postal address
Table 3: Preferences
- Food
- Color
If you wanted to use this database within your web application, you would need to create three entities which look like this.
public class User
{
public string Name { get; set; }
public string Surname { get; set; }
public string IDNumber { get; set; }
}
public class Address
{
public string ResidentialAddress{ get; set; }
public string PostalAddress{ get; set; }
}
public class Preferences
{
public string Food{ get; set; }
public string Color{ get; set; }
}
In a large number of C# web projects, if you deal with databases, your project would likely have a folder called "entities" and it would include classes called entities, just like the examples shown above.
There is quite a bit of qualifying required on the above and it also strongly depends on what framework you use, but the above is the most common practical interpretation on entity.
I think this is a common way to explain what an entity is in .NET:
An entity represents a specific object (such as a specific customer or order). Each entity must have a unique entity key within an entity set. An entity set is a collection of instances of a specific entity type. Entity sets (and association sets) are logically grouped in an entity container.
© 2022 - 2024 — McMap. All rights reserved.