Entity Framework Development Scenarios
Entity Framework provides three development scenarios:
Author: Rick Saling
Database-First, which reverse engineers an already existing database;
Code-First, which can either connect to an existing database, or generate one from code;
Model-First, which generates a database from a conceptual model.
Entity Framework (“EF”) has no features that deal with Base de données SQL Windows Azure Federations. This means that EF is unable to create federations, federate tables, or point to the appropriate federation member via the USE FEDERATION statement, among other things.
Therefore the simplest scenario to use with Federations is Code-First or Database-First, in which Entity Framework starts with an existing federated database and reverse-engineers it in order to generate the conceptual model and object runtime. One important thing to keep in mind is that a federated database actually consists of a root member, and multiple federated members, each of which is a separate database. So you will be reverse-engineering one of the federated members, not the entire federation.
Reverse-Engineer Existing Database Scenario
The schemas for the different federation members need not be identical: one use scenario for Federations is to incrementally upgrade table schemas, one Federation member at a time. This is particularly useful for multi-tenant federations, where each tenant may decide to upgrade at different times.
In this Guide, we use the AdventureWorks sample database as the basis for examples, and use the Database-First development scenario.
You could also use Code First with an existing federated database, much the same as with Database First.
Generate Database Scenarios
The reason that you cannot use Model First or Code First without an existing database is that EF has no knowledge of Federations, so you could create a single database, but then you would need to create the federation outside of EF, using tools such as SQL Server Management Studio.
This may be a feasible scenario, but it is not one that will be dealt with in this Guide. In any case, much of the development process (except for generating the database) will apply equally to this scenario. It’s also reasonable to create your application against a non-federated database using Code First or Model First, and then federate the database after you create the application.
Date de génération :
Si vous souhaitez y participer,