Before we generate database schema, we can do 2 things
1. Validate our model
2. See our model in XML format
1. Validate our model, right-click on any space –> Validate
The Error List will pop-up, but actually there is no error but 2 warnings. It is because our database hasn’t been created and the tables are not exist.
2. See our model in XML format, right-click on SalesOrder.edmx –> Open With…
Choose XML (Text) Ediror –> click OK
Since the edmx file can only been open by once (in either design mode or XML text mode). Click Yes to close current design mode.
There are 3 major contents in the file,
1. SSDL content
2. CSDL content (expend in next picture)
3. C-S mapping content
CSDL content part, if we point to that, it will show an Error 11007: Entity type ‘xxxx’ is not mapped. It’s the same message in previous Validate action above.
Now we can re-open our model design window, and right-click on any space –> Generate Database from Model…
Make sure we are connenct to right destination
If the database we are going to connect is not exist, click Yes to attempt to create it.
Click Next with the right connection string
The DDL file will be generated for our review, and we can click Finish to save it
Now we will see the file xxx.edmx.sql open
沒有留言:
張貼留言