Creating and Editing Type Mapping Rules

This topic describes how to work with type mapping rules in Entity Developer and provides an explanation of the specifics of mapping types in Entity Developer.

note Note

Changes introduced through the use of the procedures described below are applicable to the way the entire Entity Developer  application works rather than a particular model, so you must be extra careful when changing or removing type mapping rules.

In Entity Developer, you can:

create type mapping rules;
edit/restore default type mapping rules;
enable/disable type mapping rules;
and remove type mapping rules.

The procedures for executing each of these actions are given below.

To access the list of type mapping rules do the following:

1.From the application's main menu, select Tools and then select Options.

note Note

If you are using Entity Developer as an add-in to Microsoft Visual Studio, to access this functionality, select Tools --> Options and then, in the navigation pane of the Options dialog box, select Entity Developer --> Servers' Options.

The Options dialog box is displayed:

Images_Options_dialog_box

note Note

The list of supported database servers under Servers' Options depends on the database servers that the installed edition of our product supports and may differ from the one in the picture above.

2.(Optional) Under Servers' Options, select the required server.

To enable/disable type mapping rules:

use the corresponding check box column in the Type Mapping Rules list of the Options dialog or the corresponding check box in the Type Mapping Rule Editor dialog box.

 

ExpandedToggleIcon        Editing a Type Mapping Rule

Entity Developer contains a set of predefined type mapping rules that the user can edit.

To edit a type mapping rule, perform the following sequence of actions:

1.In the Type Mapping Rules list select the rule you want to edit.
2.In the Options dialog box, click Edit.

The Type Mapping Rule Editor dialog box is displayed:

Images_TypeMappingRuleEditor_editing

note Note

If editing results in changes in the intervals of a sub-rule, ensure that the order of sub-rules within a main rule is modified accordingly, as described in the procedure for adding sub-rules (see below).

3.Change the required data in the available boxes and click OK to save your changes.

The selected type mapping rule is successfully changed.

note Note

It is also possible to restore default type mapping rules by clicking the Reset button in the Options dialog box. When default type mapping rules are restored, all custom (user-created) type mapping rules are irretrievably lost.

ExpandedToggleIcon        Adding a Main Type Mapping Rule

In Entity Developer, you can add your own custom rules for mapping server types to .NET types. For that purpose, perform the following sequence of actions:

1.In the Options dialog box, click Add or press the INSERT key.

The Type Mapping Rule Editor dialog box is displayed:

Images_TypeMappingRuleEditor

2.From the .NET Type drop-down list, select the required .NET type.
3.In the Server Type box, enter or select the required server type to map to.
4.(Optional) In the Precision area, specify the precision range.
5.(Optional) In the Scale area, specify the scale range.
6.(Optional) In the Length area, specify the length range.
7.Click OK.

The new type mapping rule is successfully added to the list of rules:

Images_Options_dialog_box_added

 

ExpandedToggleIcon        Adding a Type Mapping Sub-Rule

Main rules for type mapping can have an unlimited number of sub-rules. The procedure for adding a sub-rule to the main rule is highly similar to the procedure of adding a main rule; however, you must select the server rule, which you want to add a sub-rule to.

Another thing to remember while adding sub-rules  is that the order, in which sub-rules are displayed under the main rule, is of extreme importance, since the application checks the sub-rules from top to bottom within the main rule.

For the sake of example, suppose that  you have the following main rule and a number of sub-rules in it:

Images_NUMBERS_EXAMPLE

Now suppose that you need to add another sub-rule with the following parameters: precision = 7 and scale = 3. After the procedure for adding a sub-rule has been completed, the new sub-rule is displayed in the end of the sub-rule list:

Images_NUMBERS_EXAMPLE2

Since the application performs checks from top to bottom, in the situation, when it receives the NUMBER type precision equal to 7, the checks will be stopped at the first sub-rule, that is, at NUMBER (10...18, 0), while the sub-rule you have created will never be used at all.

To remedy this situation, you need to drag and drop your newly created rule two positions up, so that the order, in which sub-rules are placed within the main rule, will be as follows:

Images_NUMBERS_EXAMPLE3

ExpandedToggleIcon        Removing a Type Mapping Rule

In Entity Developer, you can remove available type mapping rules.

To remove a type mapping rule, perform the following sequence of actions:

1.In the Type Mapping Rules select the rule you want to delete and click Remove or press the DELETE key.
2.The following warning message is displayed:

Images_Warning

3.  Click Yes.

The selected type mapping rule is successfully removed.

 

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.