I have the DBML file of a database and would like to generate an SQL database file from this file.
Thanks
I have the DBML file of a database and would like to generate an SQL database file from this file.
Thanks
I know of no available utilities that do that, and it's a bit much to do for a SO answer.
But, for the most part, it's not that big a deal. The DBML file is written in XML; it should be easy to read via Linq-to-xml. Then just split out the SQL commands for the values in the xml into a script file. Then run the script. (It also could be done with a XSLT transformation)
<Table Name="dbo.Person" Member="Persons">
becomes
CREATE TABLE Persons (
and
<Column Name="PersonID" Type="System.Int32" DbType="Int NOT NULL IDENTITY"
IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false">
</Column>
<Column Name="AddressID" Type="System.Int32" DbType="Int NOT NULL"
CanBeNull="false"></Column>
becomes:
PersonID Int NOT NULL,
AddressID int NOT NULL,
and so on.