Export (0) Print
Expand All

Books Authors Web Service (EDM Sample Application)

.NET Framework 3.5

An object model built from entities and associations in the Entity Data Model (EDM) can be used in Web applications. Establishing an EntityConnection in a Web application requires some different procedures from those used to instantiate the EntityConnection in conventional applications, but the programmable data types work the same as in conventional applications. The same schemas and mapping files are used to build programmable classes and to map them to storage. The DLL used in conventional applications can be referenced by Web applications.

Books Authors Object Model

The application in this example is a Web service that can be queried online by other applications for results that contain output generated by entities and associations that represent books, authors, and related information. Five methods are implemented by the Web service:

  • GetBooks

  • GetAuthors

  • GetAuthorsFromBookTitle

  • GetBooksFromAuthorLastName

  • AddBook

The object model includes three entities designed to provide lists of books, lists of authors, and book information entities that contain title/author pairs and information locator URLs or UNC paths on a network. The following entities are implemented by the application:

  • Books

  • Authors

  • BookInfo

Two associations are implemented to connect book entities and author entities to book information entities:

  • Author_BookInfo

  • Book_BookInfo

One function of the BookInfo entity is to navigate the many-to-many relationship between books and authors. Each book can have more than one author, and each author can be the author of more than one book. The second function of the BookInfo entity is to contain a URL or UNC path to information about the book.

The InfoLocator property of the BookInfo entity is implemented as a string property that can be assigned a value that contains the path to online reviews or other documents that contain information about the book.

Any number of BookInfo entities can be instantiated to relate books, authors, and relevant information.

Web Service Description

Web services return results as XML data. Data in the XML format can be assigned without conversion to the data source property of a data grid control. It can be parsed by data applications that run on networked computers or on the Internet.

Each method provided by the Web service provides a Web page that displays the method syntax and an interface to invoke the method with its parameters. The following screen shot shows the Web service methods displayed in the user interface.

Web Service description view in Internet Explorer

For more information about implementing the entities and associations of this Web service application, see Books Authors Web Service Schemas (EDM Sample Application) and Books Authors Web Service Implementation (EDM Sample Application).

See Also

Community Additions

Show:
© 2014 Microsoft