Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EAnnotation usage in ecore

Can anybody explain the usage of EAnnotation in ecore, in terms of its specific fields (i.e., Source, Details, EModel Element, Contents, and References). I looked at its API documentation here, but could not get that much from there.

I am looking for a kind of guideline to explain by example what are the purpose of having annotations with such fields in ecore.

like image 254
qartal Avatar asked May 07 '15 22:05

qartal


People also ask

How do data annotations work in EF 6 and EF Core?

These data annotation attributes work in the same way in EF 6 and EF Core and are valid in both. Note: Data annotations only give you a subset of configuration options. Fluent API provides a full set of configuration options available in Code-First.

What are the data annotation attributes in Entity Framework?

These attributes are not only used in Entity Framework but they can also be used with ASP.NET MVC or data controls. These data annotation attributes work in the same way in EF 6 and EF Core and are valid in both. Note: Data annotations only give you a subset of configuration options.

What is the use of data annotation?

In .NET Framework, data annotation add extra meaning to the data by adding attribute tags. It is used to configure the classes which will highlight the most commonly needed configurations.


1 Answers

I asked this question in Eclipse EMF forum and here is an answer. There is also an answer to this question here..

However, I briefly provide an answer to this question: Generally EAnnotations are used in Ecore to encode any kind of information which is not captured by Ecore at first place. For example, they are used in OCLInECore to hold OCL constraints, or in genmodel to store code generation related information and etc.

Source is used to identify the type of annotation. It is usually populated with a URI, to uniquely identify the type of annotation.

Details is a set of (key,value) pairs to hold detailed information regarding this annotation. Actually this is the place annotation data are really stored.

The rest is (quoted from here):

EModel Element , "An EAnnotation is itself an EModelElement, so can also be annotated. It's not often used, but would allow you to build a complex structure.."

Contents EAnnotations can contain arbitrary other objects. This is also not often used, and if you do use it, you can't generate a normal XyzPackageImpl but must ensure that the GenPackage specifies "Initialize by Loading"..."

References. "EAnnotations can refer to arbitrary other objects. This is also not often used, and the same caveat applies and for the contents..."

like image 171
qartal Avatar answered Oct 10 '22 00:10

qartal