Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
I want to generate database script from edmx using C# Code. I have been finding this since long time but i need a proper guidance.


What I have tried:

C#
I want to generate database script from edmx using C# Code. I tried with sqldatareader and GetScheama() function but it is not working.
Posted
Updated 27-Dec-16 21:53pm

1 solution

Try this...

//Initialise your context here
DBEntities db = new DBEntities();
var DataBaseScript = ((IObjectContextAdapter)db).ObjectContext.CreateDatabaseScript();
 
Share this answer
 
Comments
Member 11518177 28-Dec-16 3:55am    
That works ... Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900