Database Reference
In-Depth Information
8. Click OK to close the exception window, and close the opened form, which will
be empty because the data did not load due to an exception occurring.
9. Now you will see the advantage of entity data modeling. Assume the same
issue occurred in the code you wrote in previous chapters; the only solution is
to modify the column name in each and every SQL statement that maps to the
table we modified. In a real-world scenario, this will not be possible, because
database schema updates changes are invisible and so the Entity Data Model
comes to rescue.
To fix this application, you have to modify the XML mapping file created by the
Entity Data Model, namely, the AWCurrencyModel.edmx file you created earlier
in the chapter. To view the XML mapping, navigate to Solution Explorer, right-
click AWCurrencyModel.edmx , and choose the Open With option. From the
provided dialog box, select XML(Text) Editor, and click OK. You will see the
XML mapping, as shown previously in Figure 19-10.
Note In the opened XML mapping file, navigate to the <!-- SSDL content --> section and modify the name
in the <Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" /> XML tag to
CurrencyName ; the tag should appear as <Property Name="CurrencyName" Type="nvarchar"
Nullable="false" MaxLength="50" /> after the modification.
Note The logical model, which represents the database schema, is defined in an XML file using SSDL. This is
why you need to modify the column names to map with the database schema.
10. Also, modify the <Property Name="ModifiedDate" Type="datetime"
Nullable="false" /> XML tag to ModifiedCurrencyDate <Property
Name="ModifiedCurrencyDate" Type="datetime" Nullable="false" /> XML tag
to appear as <Property Name="ModifiedCurrencyDate" Type="datetime"
Nullable="false" /> . The modified SSDL content section with the
CurrencyName and ModifiedCurrencyDate values will look like Figure 19-14.
 
Search WWH ::




Custom Search