February 2010
Beginner
400 pages
11h 13m
English
Model-defined functions allow you to define reusable functions at a model level. To create them at present, you must modify the .edmx file directly, although this will probably change in future versions of EF. In our convoluted example, we will create a new property for our Film entity that will return the Film title and description separated by a space.
Right-click the Chapter8Model.edmx file and select Open With.
Select XML Editor.
Find the following section:
<edmx:ConceptualModels>
<Schema Namespace="BookModel" Alias="Self"
xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
Add the following inside the previous section:
<Function Name="LongFilmDescription" ...