sql - Visual Studio 2015 Database project -
i need exclude tables publishing in database project, main idea publish subset of tables depending on build configuration, if it's debug want publish tables if configuration release want publish subset of tables.
try code:
[conditional("release")] public static void insertconditionally(yourdbcontext context) { context.database.migrate(); if( !context.products.any()) { context.products.addrange( new product("name 1 release", "param 1"), new product("name 2 release", "param 1"), new product("name 3 release", "param 1") ); context.savechanges(); } } [conditional("debug")] public static void insertconditionally(yourdbcontext context) { context.database.migrate(); if (!context.products.any()) { context.products.addrange( new product("name 1 debug", "param 1"), new product("name 2 debug", "param 1"), new product("name 3 debug", "param 1") ); context.savechanges(); } }
Comments
Post a Comment