concept Web Part class in category sharePoint

appears as: Web Part class, Web Part class, The Web Part class
SharePoint 2010 Web Parts in Action

This is an excerpt from Manning's book SharePoint 2010 Web Parts in Action.

The Web Part Gallery is a special catalog created by SharePoint to host the site collection’s Web Parts. When users are building Web Part pages using either the browser or SharePoint Designer, they pick the Web Parts they need by selecting them from the gallery. The gallery doesn’t contain the compiled Web Part assembly; it’s simply a list of Web Part items with metadata columns and a file attachment that contains a Web Parts control description file. This file contains the default value used by any created instance of the Web Part as well as the reference to the assembly and Web Part class. All Web Parts can also have a group value, which is used for organizing and grouping the Web Parts.

The Web Part Gallery contains a set of preconfigured templates for Web Parts that editors can choose from. When you’re adding a Web Part to a page, the Web Part properties are copied from the control description file to the page. If you later go back and edit the Web Part in the gallery, this change won’t affect Web Parts that have already been added. Chapter 3 will show you what the Web Parts control description file looks like and how it works. When I talk about Web Parts in the Web Part Gallery, I’m referring to the definition and configuration of a Web Part. That’s also what end users are referring to when they talk about Web Parts. When a developer talks about a Web Part, they’re most often talking about the Web Part class existing in an assembly.

If you’re building a Visual Web Part, you have to define the properties in the Web Part class, not the user control. SharePoint or SharePoint Designer won’t pick up or store properties that are defined in any underlying control. You need to include extra plumbing when working with Visual Web Parts and Web Part properties to ensure that the properties are copied or referenced to the user control (if it needs the properties). The values of the properties exist in the Web Part before the OnInit method, as you saw in chapter 4, so you can use the property value in the CreateChildControls method.