You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code-quality/C26426.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -25,20 +25,24 @@ The order of execution of initializers for global objects may be inconsistent or
25
25
26
26
## Remarks
27
27
- The rule ignores calls to constexpr functions or intrinsic functions on assumption that these either will be calculated at compile time or guarantee predictable execution at runtime.
28
-
- Calls to inline functions are still flagged since the checker doesn’t attempt to analyze their implementation.
29
-
- This rule can be quite noisy in many common scenarios where a variable of a user defined type (or standard container) is initialized globally: this is often due to calls to constructors and destructors. This is still a valid warning since it points to places where unpredictable behavior may exist or future changes in external code may introduce instability.
30
-
- Static class members are considered global, so their initializers are also checked.
31
-
## Example
32
-
external version check
33
-
// api.cpp
34
-
int api_version = API_DEFAULT_VERSION; // Assume it can change at runtime, hence non-const.
35
-
int get_api_version() noexcept {
28
+
- Calls to inline functions are still flagged since the checker doesn’t attempt to analyze their implementation.
29
+
- This rule can be quite noisy in many common scenarios where a variable of a user defined type (or standard container) is initialized globally: this is often due to calls to constructors and destructors. This is still a valid warning since it points to places where unpredictable behavior may exist or future changes in external code may introduce instability.
30
+
- Static class members are considered global, so their initializers are also checked.
31
+
32
+
## Example
33
+
external version check
34
+
35
+
```cpp
36
+
// api.cpp
37
+
int api_version = API_DEFAULT_VERSION; // Assume it can change at runtime, hence non-const.
38
+
intget_api_version() noexcept {
36
39
return api_version;
37
-
}
40
+
}
38
41
39
42
// client.cpp
40
43
intget_api_version() noexcept;
41
44
bool is_legacy_mode = get_api_version() <= API_LEGACY_VERSION; // C26426, also stale value
Copy file name to clipboardExpand all lines: docs/code-quality/code-analysis-for-managed-code-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ Frequently, it is useful to indicate that a warning is non-applicable. This info
45
45
In-source suppression of warnings is implemented through custom attributes. To suppress a warning, add the attribute `SuppressMessage` to the source code as shown in the following example:
Copy file name to clipboardExpand all lines: docs/data-tools/add-custom-controls-to-the-data-sources-window.md
+29-26Lines changed: 29 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -21,53 +21,56 @@ ms.workload:
21
21
- "data-storage"
22
22
---
23
23
# Add custom controls to the Data Sources window
24
+
24
25
When you drag an item from the **Data Sources** window to a design surface to create a data-bound control, you can select the type of control that you create. Each item in the window has a drop-down list that displays the controls that you can choose from. The set of controls associated with each item is determined by the data type of the item. If the control that you want to create does not appear in the list, you can follow the instructions in this topic to add the control to the list.
25
26
26
-
For more information about selecting data-bound controls to create for items in the **Data Sources** window, see [Set the control to be created when dragging from the Data Sources window](../data-tools/set-the-control-to-be-created-when-dragging-from-the-data-sources-window.md).
27
+
For more information about selecting data-bound controls to create for items in the **Data Sources** window, see [Set the control to be created when dragging from the Data Sources window](../data-tools/set-the-control-to-be-created-when-dragging-from-the-data-sources-window.md).
28
+
29
+
## Customize the bindable controls list
27
30
28
-
> [!NOTE]
29
-
> The dialog boxes and menu commands you see might differ from those described in Help, depending on your active settings or edition. To change your settings, on the **Tools** menu, select **Import and Export Settings**. For more information, see [Personalize the Visual Studio IDE](../ide/personalizing-the-visual-studio-ide.md).
31
+
To add or remove controls from the list of available controls for items in the **Data Sources** window that have a specific data type, perform the following steps.
30
32
31
-
## <aname="customizinglist"></a> Customize the list of bindable controls for a data type
32
-
To add or remove controls from the list of available controls for items in the **Data Sources** window that have a specific data type, perform the following steps.
33
+
### To select the controls to be listed for a data type
33
34
34
-
#### To select the controls to be listed for a data type
35
+
1. Make sure that the WPF Designer or the Windows Forms Designer is open.
35
36
36
-
1. Make sure that the WPF Designer or the Windows Forms Designer is open.
37
+
2. In the **Data Sources** window, click an item that is part of a data source you added to the window, and then click the drop-down menu for the item.
37
38
38
-
2. In the **Data Sources** window, click an item that is part of a data source you added to the window, and then click the drop-down menu for the item.
39
+
> [!TIP]
40
+
> If the **Data Sources** window isn't open, open it by selecting **View** > **Other Windows** > **Data Sources**.
39
41
40
-
3.In the drop-down menu, click **Customize**. One of the following dialog boxes opens:
42
+
3. In the drop-down menu, click **Customize**. One of the following dialog boxes opens:
41
43
42
-
-If the **Windows Forms Designer** is open, the **Data UI Customization** page of the **Options** dialog box opens.
44
+
- If the **Windows Forms Designer** is open, the **Data UI Customization** page of the **Options** dialog box opens.
43
45
44
-
-If the **WPF Designer** is open, the **Customize Control Binding** dialog box opens.
46
+
- If the **WPF Designer** is open, the **Customize Control Binding** dialog box opens.
45
47
46
-
4.In the dialog box, select a data type from the **Data type** drop-down list.
48
+
4. In the dialog box, select a data type from the **Data type** drop-down list.
47
49
48
-
-To customize the list of controls for a table or object, select **[List]**.
50
+
- To customize the list of controls for a table or object, select **[List]**.
49
51
50
-
-To customize the list of controls for a column of a table or a property of an object, select the data type of the column or property in the underlying data store.
52
+
- To customize the list of controls for a column of a table or a property of an object, select the data type of the column or property in the underlying data store.
51
53
52
-
-To customize the list of controls to display data objects that have user-defined shapes, select **[Other]**. For example, select **[Other]** if your application has a custom control that displays data from more than one property of a particular object.
54
+
- To customize the list of controls to display data objects that have user-defined shapes, select **[Other]**. For example, select **[Other]** if your application has a custom control that displays data from more than one property of a particular object.
53
55
54
-
5.In the **Associated controls** box, select each control that you want to be available for the selected data type, or clear the selection of any controls that you want to remove from the list.
56
+
5. In the **Associated controls** box, select each control that you want to be available for the selected data type, or clear the selection of any controls that you want to remove from the list.
55
57
56
58
> [!NOTE]
57
-
> If the control that you want to select does not appear in the **Associated controls** box, you must add the control to the list. For more information, see [Adding controls to the list of associated controls for a data type](#addingcontrols).
59
+
> If the control that you want to select does not appear in the **Associated controls** box, you must add the control to the list. For more information, see [Add associated controls](#add-associated-controls).
58
60
59
-
6.Click **OK**.
61
+
6. Click **OK**.
60
62
61
-
7.In the **Data Sources** window, click an item of the data type that you just associated one or more controls, and then click the drop-down menu for the item.
63
+
7. In the **Data Sources** window, click an item of the data type that you just associated one or more controls, and then click the drop-down menu for the item.
62
64
63
65
The controls you selected in the **Associated controls** box now appear in the drop-down menu for the item.
64
66
65
-
## <aname="addingcontrols"></a> Add controls to the list of associated controls for a data type
66
-
If you want to associate a control with a data type, but the control does not appear in the **Associated controls** box, you must add the control to the list. The control must be located in the current solution or in a referenced assembly. It must also be available in the **Toolbox** and have an attribute that specifies the control's data binding behavior.
67
+
## Add associated controls
68
+
69
+
If you want to associate a control with a data type, but the control does not appear in the **Associated controls** box, you must add the control to the list. The control must be located in the current solution or in a referenced assembly. It must also be available in the **Toolbox** and have an attribute that specifies the control's data binding behavior.
67
70
68
-
####To add controls to the list of associated controls
71
+
### To add controls to the list of associated controls
69
72
70
-
1.Add the desired control to the **Toolbox** by right-clicking the **Toolbox** and selecting **Choose Items**.
73
+
1. Add the desired control to the **Toolbox** by right-clicking the **Toolbox** and selecting **Choose Items**.
71
74
72
75
The control must have one of the following attributes.
73
76
@@ -77,12 +80,12 @@ When you drag an item from the **Data Sources** window to a design surface to cr
77
80
|<xref:System.ComponentModel.ComplexBindingPropertiesAttribute>|Implement this attribute on controls that display lists (or tables) of data, such as a <xref:System.Windows.Forms.DataGridView>.|
78
81
|<xref:System.ComponentModel.LookupBindingPropertiesAttribute>|Implement this attribute on controls that display lists (or tables) of data, but also need to present a single column or property, such as a <xref:System.Windows.Forms.ComboBox>.|
79
82
80
-
2.For Windows Forms, on the **Options** dialog box, open the **Data UI Customization** page. Or, for WPF, open the **Customize Control Binding** dialog box. For more information, see [Customizing the list of bindable controls for a data type](#customizinglist).
83
+
2. For Windows Forms, on the **Options** dialog box, open the **Data UI Customization** page. Or, for WPF, open the **Customize Control Binding** dialog box. For more information, see [Customize the list of bindable controls for a data type](#customize-the-bindable-controls-list).
81
84
82
-
3.In the **Associated controls** box, the control that you just added to the **Toolbox** should now appear.
85
+
3. In the **Associated controls** box, the control that you just added to the **Toolbox** should now appear.
83
86
84
87
> [!NOTE]
85
-
> Only controls that are located within the current solution or in a referenced assembly can be added to the list of associated controls. (The controls must also implement one of the data-binding attributes in the previous table.) To bind data to a custom control that is not available in the **Data Sources** window, drag the control from the **Toolbox** onto the design surface, and then drag the item to bind to from the **Data Sources** window onto the control.
88
+
> Only controls that are located within the current solution or in a referenced assembly can be added to the list of associated controls. (The controls must also implement one of the data-binding attributes in the previous table.) To bind data to a custom control that is not available in the **Data Sources** window, drag the control from the **Toolbox** onto the design surface, and then drag the item to bind to from the **Data Sources** window onto the control.
Copy file name to clipboardExpand all lines: docs/data-tools/add-new-data-sources.md
+13-4Lines changed: 13 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Add new data sources
3
-
ms.date: 11/04/2016
3
+
ms.date: 11/21/2018
4
4
ms.topic: conceptual
5
5
f1_keywords:
6
6
- "vs.datasource.datasourcefieldspicker"
@@ -18,7 +18,7 @@ ms.workload:
18
18
---
19
19
# Add new data sources
20
20
21
-
In the context of .NET data tools in Visual Studio, the term *data source* refers to .NET objects that connect to a data store and expose the data to a .NET application. The Visual Studio designers can consume the output of the data source to generate the boilerplate code that binds the data to forms when you drag and drop database objects from the **Data Sources** window. This kind of data source can be:
21
+
In the context of .NET data tools in Visual Studio, the term *data source* refers to .NET objects that connect to a data store and make the data available to a .NET application. The Visual Studio designers can consume the output of the data source to generate the boilerplate code that binds the data to forms when you drag and drop database objects from the **Data Sources** window. This kind of data source can be:
22
22
23
23
- A class in an Entity Framework model that is associated with some kind of database.
24
24
@@ -31,13 +31,22 @@ In the context of .NET data tools in Visual Studio, the term *data source* refer
31
31
- A class or collection in your solution.
32
32
33
33
> [!NOTE]
34
-
> If you are not using data-binding features, datasets, Entity Framework, LINQ to SQL, WCF, or SharePoint, the concept of a "data source" does not apply. Just connect directly to the database by using the SQLCommand objects and communicate directly with the database.
34
+
> If you're not using data-binding features, datasets, Entity Framework, LINQ to SQL, WCF, or SharePoint, the concept of a "data source" does not apply. Just connect directly to the database by using the SQLCommand objects and communicate directly with the database.
35
35
36
36
You create and edit data sources by using the **Data Source Configuration Wizard** in a Windows Forms or Windows Presentation Foundation application. For Entity Framework, first create your entity classes, and then start the wizard by selecting **Project** > **Add New Data Source** (described in more detail later in this article).
After you create a data source, it appears in the **Data Sources** tool window (**Shift**+**Alt**+**D** or **View** > **Other Windows** > **Data Source**). You can drag a data source from the **Data Sources** window onto a form design surface or control. This causes boilerplate code to be generated that displays the data from the data store. The following illustration shows a dataset that has been dropped onto a Windows form. If you select **F5** on the application, the data from the underlying database appears in the form's controls.
40
+
## Data Sources window
41
+
42
+
After you create a data source, it appears in the **Data Sources** tool window.
43
+
44
+
> [!TIP]
45
+
> To open the **Data Sources** window, make sure your project is open, and then press **Shift**+**Alt**+**D** or choose **View** > **Other Windows** > **Data Sources**.
46
+
47
+
You can drag a data source from the **Data Sources** window onto a form design surface or control. This causes boilerplate code to be generated that displays the data from the data store.
48
+
49
+
The following illustration shows a dataset that has been dropped onto a Windows form. If you select **F5** on the application, the data from the underlying database appears in the form's controls.
0 commit comments