. Net metadata, metadata

Source: Internet
Author: User

. Net metadata, metadata
Overview

Programs developed on the. net platform are compiled into the following components: IL code, resources, assembly list, and type metadata. We know that IL code is the code we have written. Resources are image files, xml files, and other files, but metadata is not clear (here, the Assembly List is metadata ), this blog is mainly about the understanding of metadata.

What is metadata?

What is metadata? Let's take a look at Baidu encyclopedia's concept: Metadata: data describing data, descriptive information about data and information resources. After reading this definition, I feel like, I don't need to see anyone who can't. From this definition, I can only say that the Chinese language is too broad and profound. I didn't understand it at the beginning, I also understood some things of the Titans. Let's talk about my current understanding of metadata.

The program we write finally compiles the program assembly. The metadata is to describe what is in our Assembly, such as: what classes are there, what class access level is, and so on, and, what are the Members in this class, and the attributes of these Members, such as their types and access levels. Of course, it also describes the relationship between the Assembly of the program set. As to why these things are necessary, this is the content of metadata.

Role of metadata

We know what metadata is. In this module, we are talking about the role of metadata. If we want to know the role of metadata, we need to know why, we all know, the condition for the emergence of a new thing and its rapid success is that it solves the bad phenomenon at that time. So what is the bad phenomenon?

When Microsoft did not launch the metadata technology, one problem occurred was that binary code reuse was very troublesome. At that time, binary reuse was implemented through the com technology, that is, we compile a com component and then compile the content for others to use. Others cannot use it well. Why? When others call the content of your com component again, It is hard-coded. hard-coded means that there is no smart prompt. The called method does not know whether it is a method in the com component, I don't know if I have written an error. If I want to know that I have to run it, I know that the internal methods of the com component are known through the com operation manual, but how inconvenient it was at that time.

The emergence of com technology is also very powerful. Why is it so powerful? Before it, we almost couldn't write a library that gives us peace of mind. Why? Before the emergence of com, our program can only directly call the source code. If we want to write a library for use by others, we must give your source code to others, after the program is compiled, generate the compilation and generation in a unified manner. You think that if you write nothing, you have to give the source code to others, then people have everything.

The above is a whole process of metadata generation. Its main function is to solve the reuse of binary code.

Use of metadata

Those things mentioned above, I believe everyone knows that metadata can be directly used by the VS integrated development environment and is very common. For example, we add an Assembly reference, it is very convenient to use directly. It is simply because the Assembly metadata is used. So, is metadata just that? Of course not. In fact, metadata can also be used by our programmers. One way to use it is reflection. The reflection technology is achieved using metadata. Through reflection technology, you can obtain information about the Assembly, information about the class, and information about the class. You can create an object and call methods.

In addition to the metadata generated by the system, you can add metadata for classes, methods, attributes, and so on during programming. This is the generation of features, features are abstract at a higher level.

Summary

. The metadata of net is not its original source, but a reference of java ,. net and java are a lot of things for reference by projects; metadata is not. net excessive burden, but put. net to a higher level of coach.


Net metadata

The person you ask for is honest. What's different from java is that metadata is heavily used in. net. The so-called metadata is actually a pure description, which can be sent to another program domain (possibly on another machine or local machine ), then restore the data. That is to say, some of the content can be serialized (it is indeed equivalent to packaging, but the packaging type is not an array). You can understand serialization as another common data representation, in fact, it is only used to describe how to exist in memory units. It is a description of object to memory. After it is sent to another program domain, it can be restored, and the restoration process is called deserialization. GC can also view the object's survival status based on the metadata and recycle it. In fact, metadata exists, and you can determine the type of the object where the memory is located.

Because of the existence of a large amount of metadata, we also have a better use-reflection, which is implemented on the basis of metadata .. Net programmers are the most happy part of reflection-but it has become a widely criticized place, the existence of a large number of metadata, this causes performance degradation-which is incomprehensible to programmers in other languages.

For metadata and reflection, you can query msdn. However, we recommend that you go to the blog to check the java and. net attacks on each other. It is very interesting to learn a lot-a group of java programmers have been holding on. the reflection of net programmers and the existence of a large number of metadata lead to a reduction in performance. Some people try to remove some of the metadata when generating the program-they are all good technical posts.

What is the metadata in movie Net?

Metadata is the data and methods in the system after you reference others' projects or built-in DLL files. For example, when you use a three-tier architecture, The BLL layer references the DLL files of the DAL layer, you can call methods on the DLL layer, but when you perform "to definition" On The BLL layer, the called DAL layer method will be metadata, you can only see the specific implementation code of the method name parameter. You cannot see the implementation code of the called method only in the DAL layer.
You can also go to Baidu baike.baidu.com/view/107838.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.