I am trying to start the DDL of the Elmah Sql server when creating a database in my EF4.1 CodeFirst application.
To accomplish this, in my DbInitializer.Seed method, I have:
protected override void Seed(MyJobLeadsDbContext context) {
GetElmahDDLSql is just a string constant that contains all DDL from http://code.google.com/p/elmah/source/browse/trunk/src/Elmah/SQLServer.sql
Unfortunately, when this is done, I get the following exception:
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'GO'. Incorrect syntax near the keyword 'ALTER'. Incorrect syntax near the keyword 'ALTER'. Incorrect syntax near 'GO'. Incorrect syntax near the keyword 'SET'. Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Must declare the scalar variable "@ErrorId". Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Must declare the scalar variable "@TotalCount". Must declare the scalar variable "@PageIndex". Must declare the scalar variable "@TotalCount". Must declare the scalar variable "@Application". Must declare the scalar variable "@PageSize". Must declare the scalar variable "@PageSize". Must declare the scalar variable "@Application". Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Incorrect syntax near 'GO'. Must declare the scalar variable "@ErrorId". Incorrect syntax near 'GO'. Incorrect syntax near 'GO'.
Any idea how to properly execute DDL through EF4.1?
source share