/// <summary> /// Set database initializer /// </summary> public override void SetDatabaseInitializer() { var customCommands = new List<string>(); //use webHelper.MapPath instead of HostingEnvironment.MapPath which is not available in unit tests customCommands.AddRange(ParseCommands(HostingEnvironment.MapPath("~/App_Data/SqlServer.Indexes.sql"), false)); //use webHelper.MapPath instead of HostingEnvironment.MapPath which is not available in unit tests customCommands.AddRange(ParseCommands(HostingEnvironment.MapPath("~/App_Data/SqlServer.StoredProcedures.sql"), false)); var initializer = new ExecuteCustomCommands<AaronDbContext>(customCommands.ToArray()); Database.SetInitializer(initializer); }
/// <summary> /// Set database initializer /// </summary> public override void SetDatabaseInitializer() { var customCommands = new List <string>(); //use webHelper.MapPath instead of HostingEnvironment.MapPath which is not available in unit tests customCommands.AddRange(ParseCommands(HostingEnvironment.MapPath("~/App_Data/SqlServer.Indexes.sql"), false)); //use webHelper.MapPath instead of HostingEnvironment.MapPath which is not available in unit tests customCommands.AddRange(ParseCommands(HostingEnvironment.MapPath("~/App_Data/SqlServer.StoredProcedures.sql"), false)); var initializer = new ExecuteCustomCommands <AaronDbContext>(customCommands.ToArray()); Database.SetInitializer(initializer); }