Skip to Content
Introducing .NET 4.0: with Visual Studio 2010
book

Introducing .NET 4.0: with Visual Studio 2010

by Alex Mackey
February 2010
Beginner content levelBeginner
400 pages
11h 13m
English
Apress
Content preview from Introducing .NET 4.0: with Visual Studio 2010

8.12. Model-Defined Functions

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.

  1. Right-click the Chapter8Model.edmx file and select Open With.

  2. Select XML Editor.

  3. 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">
  4. Add the following inside the previous section:

    <Function Name="LongFilmDescription" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 3.5 For Dummies®

ASP.NET 3.5 For Dummies®

Ken Cox
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9781430224556Purchase book