In order to begin working with Entity Framework in VS.NET 2008, right click on a Project and select Add New Item.
Under the New Item dialog window, select data, and choose ADO.NET Entity Data Model.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU0u06q_1NQqDy2QuLVc6GKvo_dXhU5vYKpcKTn1oiysdQMW2_nhd5RoUNKQHIhPqZoK5ETPV-BsEQpTjrOJrtIXfc1tOFUjNBwF90hY9fUTxTk83NOfUuQ50dadPMmtahRyEAvSpoTsQ/s1600/create_edmx.gif)
This will create the EDMX file and corresponding codebehind classes.
Next, we need to choose the model contents, which will either start from a database source, or be a blank, new model.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbxiyuKoktDb-FerRoMq3ReOEniN-J0Fa-JwYmqR_7_OPM9zuqHjMW4JovJ7hb47F4eRZzuvCk8v04og0AP3Nc_fjkGVYGzqE_nC-C4ALYHbc5KCRoXXIqsvYylnO6jnft39H5SZfT7Zs/s1600/choose_model.gif)
I chose "Generate from Database Source", the quickest and easiest way to get up and running.
From here, you need to provide information about a database connection and database:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpsgvlj-QKndiESBcYlO-eA3kRtVP_HPMVRlXkpi0Hur-vK4FkYC1BAhD2j7uHY-H8kJ2YsprULdQ70n08krWIpv-1u99zjIK97hax8EUfwcQ8pR7ozE6BYZSTIpM-y2bBE0LjmJMqjrQ/s1600/choose_data_connection.gif)
Based on the information provided, you will be given the option to choose database objects to include in the model.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB6wzcseqcREOM9n-EMpOtE9va3z_YqmvRqNdFqef6pNz2bD8y6vmtln7qnfss1o4dNO5CaW5yV7oW6vaui3DC19XLllt3tPUp_AmS2SCtJt_WWvr9uTN5-u2zSKpS62y9zj6G3k48PTs/s1600/choose_db_objects.gif)
Finally, this will create the EDMX file and corresponding codebehind partial classes for the model.
No comments:
Post a Comment