c# - Script is not generated for a stored procedure in Entity Framework -



c# - Script is not generated for a stored procedure in Entity Framework -

i utilize entity framework create database scripts using next code:

var dbscript = ((iobjectcontextadapter)context).objectcontext.createdatabasescript();

i utilize maptostoredprocedure() method in entity mapping class. code generated create table sql script , not generate sql script stored procedure.

how can generate sql script stored procedure?

objectcontext.createdatabasescript() old code path database creation uses migrations pipeline create schema. reason, createdatabasescript doesn't know how process stored procedures. utilize code :

var configuration = new dbmigrationsconfiguration { automaticmigrationsenabled = true, contexttype = typeof(mycontext), migrationsassembly = typeof(mycontext).assembly }; var migrator = new dbmigrator(configuration); var scriptor = new migratorscriptingdecorator(migrator); string script = scriptor.scriptupdate(sourcemigration: null, targetmigration: null); console.writeline(script);

c# sql .net sql-server entity-framework

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -