I created a console application in C #. I installed the Entity Framework NuGet for this solution.
I have a class Person:
public class Person {
public int Id { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public DateTime BirthDate { get; set; }
}
I created a db context:
public class ApplicationDbContext : DbContext {
public ApplicationDbContext()
: base("MiniProjekt") { }
public DbSet<Person> Persons { get; set; }
}
Included migrations in the package manager console. The database connection is working. I get valid data for the code below (I inserted some objects before), but I don't know where the database is.
static void Main(string[] args) {
var context = new ApplicationDbContext();
Console.WriteLine(context.Persons.Count());
foreach (Person person in context.Persons) {
Console.WriteLine(person.LastName);
}
Console.ReadKey();
}
The problem is that I do not know where the .mdffile with my database is located. I clicked "Show all files in Solution Explorer", looked at the project files, and I can not find it. I want to send this project later by mail, and I would like to save the database file in the solution.
: , (, ASP.NET-MVC).
EDIT: , :
