The Entity Framework enables you to deploy model and mapping files as embedded resources of an application. The assembly with the embedded model and mapping files must be loaded in the same application domain as the entity connection. For more information, see Connection Strings. By default, the Entity Data Model tools embed the model and mapping files. When you manually define the model and mapping files, use this procedure to ensure that the files are deployed as embedded resources together with an Entity Framework application.
To maintain embedded resources, you must repeat this procedure whenever the model and mapping files are modified.
To embed model and mapping files
In Solution Explorer, select the conceptual (.csdl) file.
In the Properties pane, set Build Action to Embedded Resource.
Repeat steps 1 and 2 for the storage (.ssdl) file and the mapping (.msl) file.
In Solution Explorer, double-click the App.config file and then modify the
Metadataparameter in the
connectionStringattribute based on one of the following formats:
For more information, see Connection Strings.
The following connection string references embedded model and mapping files for the AdventureWorks Sales Model. This connection string is stored in the project's App.config file.