Ejemplo n.º 1
0
        protected override void Seed(PresentationDbContext context)
        {
            // Seed the presentations first
            context.Presentations.AddOrUpdate(
                p => p.Id,
                new Presentation
            {
                Id          = 1,
                Name        = "Test",
                Description = "Desc",
                Date        = DateTime.Now.Date
            },
                new Presentation
            {
                Id          = 2,
                Name        = "Second Presentation",
                Description = "The description for the second presentation",
                Date        = DateTime.Now.Date
            }
                );

            // Then seed some examples and FK to them using PresentationId
            context.Examples.AddOrUpdate(
                p => p.Id,
                // Examples for the first presentation
                new DataTypes
            {
                Id             = 1,
                Double         = null,
                Float          = null,
                Decimal        = null,
                Integer        = null,
                PresentationId = 1
            },
                new DataTypes
            {
                Id             = 2,
                Double         = null,
                Float          = null,
                Decimal        = null,
                Integer        = null,
                PresentationId = 1
            },
                //Examples for the second presentation
                new DataTypes
            {
                Double         = null,
                Float          = null,
                Decimal        = null,
                Integer        = null,
                PresentationId = 2
            });
        }
Ejemplo n.º 2
0
 public BusinessUnitOfWork(string conString)
 {
     _dbContext = new PresentationDbContext(conString);
 }