标签:work pre tips ber web app form cat products package
When working with Web applications, use a context instance per request.
Install-Package EntityFramework -Version
using System.Data.Entity;
public class Category{}
public class Product{}
public class ProductContext : DbContext
{
public DbSet<Category> Categories { get; set; }
public DbSet<Product> Products { get; set; }
}
public void UseProducts()
{
using (var context = new ProductContext())
{
// Perform data access using the context
}
}
标签:work pre tips ber web app form cat products package
原文地址:https://www.cnblogs.com/dalianliyan/p/13320787.html