View SampleDataSeeder.cs
using Microsoft.EntityFrameworkCore; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using MySample.Entities; | |
using SSW.DataOnion.Interfaces; | |
namespace MySample.Data.SampleData | |
{ | |
public class SampleDataSeeder : IDataSeeder | |
{ |
View Program.cs
using System; | |
using System.Collections.Generic; | |
using System.Configuration; | |
using System.Linq; | |
using Autofac; | |
using MySample.Data; | |
using MySample.Data.SampleData; | |
using MySample.Entities; | |
using SSW.DataOnion.Core; | |
using SSW.DataOnion.Core.Initializers; |
View connectionstring.xml
<connectionStrings> | |
<clear /> | |
<add name="MySampleDbConnection" connectionString="Server=(localdb)\mssqllocaldb;Database=MySample;Trusted_Connection=True;MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/> | |
</connectionStrings> |
View MySampleDbContext.cs
using System.Data.Entity; | |
using MySample.Entities; | |
namespace MySample.Data | |
{ | |
public class MySampleDbContext : DbContext | |
{ | |
public IDbSet<Product> Products { get; set; } | |
public IDbSet<ProductCategory> ProductCategories { get; set; } |
View OrderLineItem.cs
namespace MySample.Entities | |
{ | |
public class OrderLineItem | |
{ | |
public int Id { get; set; } | |
public decimal Price { get; set; } | |
public int Quantity { get; set; } |
View Order.cs
using System; | |
using System.Collections.Generic; | |
namespace MySample.Entities | |
{ | |
public class Order | |
{ | |
public int Id { get; set; } | |
public string CustomerName { get; set; } |
View Product.cs
namespace MySample.Entities | |
{ | |
public class Product | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public string Sku { get; set; } |
View ProductCategory.cs
namespace MySample.Entities | |
{ | |
public class ProductCategory | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
} | |
} |