So... here are the steps. Requires Visual Studio 2008 (not express edition, but any higher SKU will work), and Huagati DBML/EDMX Tools to be installed. (Huagati DBML/EDMX Tools is free to use for the first 45 days, if you want to continue using it after that please buy a license to support continued development).
Step 1: Create a new EDMX file (Entity Framework model file).
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggT2lgGD3xVZnwb34dwMMiT0OlEFg88G8_DPuEmtnChyphenhyphensu26pHPTemhisnsTL-xIunj7Fnm5m54f1tIggtgatwsTIiUntr0eEnmLyb-dFFUOeGqzmPQIRylh0FBrMCGcauF1mvvO1JCZ3K/s400/modelFirstSampleEF001.png)
Step 2: Choose "empty model" if you start from scratch, or "generate from database" if you have an existing database that you want to use as a base.
Step 3: Add entities, entity members, associations etc. In other words, create a model.
Step 4: Review the model...
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwcbqGHac0Xx2tfyPD-U0DTKy1kY9q4zt57SX8yP8_pnLzZt6Hy3vkSAGFPsmLbxANu1Ym8hNoa4oEoeY12MsLWSi4FF6hScBuYsoeSI0r-nJqvxpuAUlUhbC-1HZTibxXTtHMglD8fxLV/s400/modelFirstSampleEF004.png)
Step 5: Generate SSDL (Entity Framework's storage layer description) from the CSDL generated by the designer:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiurRs68CluXsZEzXQBpRxmBDOk0Sds_9Mu8_H7PO3jTz0uSPN_OIwJwVVdH4lZTfEx4juMcsCNwVKLbIgsXj7drsWGuxGSE7eHow7VHFvA8ABS1xNkogwJt0gE4-NkF3_dY51gjo4loeb4/s400/modelFirstSampleEF005.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilgtodEjAw5VX-RJPtdOhVVLSibjPv_kutsqWrQAEKvMnWQf2h5CfFbRbOsBFoPvAGQG_XUL9sXYCYkUmt8VLMemcMY9oCeRaYEoQe4-LnbWmSwmSJ2Qn4_fGC1vsRr_32Rh1mn9w8ckio/s400/modelFirstSampleEF006.png)
Step 6: After generating SSDL, the VS2008 output window shows a summary of the SSDL generation process (what was generated etc). Just as a FYI thing...
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikVqj3n_F9Ev0my-mcUFW8y36pVnO_x19fkfngUwnDMQXuALsM4oXNI114dc6fSdfma3ycvgJIgNy1M-ss_pbBmmAWRc0OAMFRLhw8uJGF1GHyYDkpctzNkrgLgRT56C7MNql5s-Fo-4_b/s400/modelFirstSampleEF007.png)
Step 7: Generate SQL-DDL for the database.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijDRVuKrlqO8SxGmjC5hN1S7fBNLQ88TGfyw1SQY_pGvA-Fbbtqeflbx8IOawhHcboqU6qSeyEmPNBFu1quaT3zVNy0OyQ42ZtWhozzDye8DS_wLWtKuccCts4yToaat8cGY01FIawNOob/s400/modelFirstSampleEF008.png)
Step 8: Review the SQL-DDL that was generated, change data types as necessary, add precision/length where needed etc.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0eWnnJWdRUI6UD1JtIC8RNw9a5eKslNQgNSw8r13p_bi5Ji-vtiC3WNVBn2nqjrMV4D1s3tYUfeon6bPJI4DQBuxUHat-gg0ls0jolfo5hrbGc92TuJJ_69BBePm9QRrBHbNjylCG6U1k/s400/modelFirstSampleEF009.png)
No comments:
Post a Comment