Obtain the path of the App_Data folder in the Seed method of the EF migration configuration class

advertisements

How do you get the path of the App_Data folder in the Seed method of the configuration class of code first migrations.

I want to read from a file I've put in the App_Data folder and the Seed method runs after the update-database command. HttpContext.Current.Server.MapPath obviously does not work because there is no HttpContext at that point.


I got it to work with something like: string MyPath = AppDomain.CurrentDomain.BaseDirectory + "/../App_Data"

because AppDomain.CurrentDomain.BaseDirectory ends at the "/bin" directory.