Ejemplo n.º 1
0
        public static bool AllMigrationApplied(this PracticeContext context)
        {
            var applied = context.GetService <IHistoryRepository>()
                          .GetAppliedMigrations()
                          .Select(m => m.MigrationId);

            var total = context.GetService <IMigrationsAssembly>()
                        .Migrations
                        .Select(m => m.Key);

            return(!total.Except(applied).Any());
        }
Ejemplo n.º 2
0
        public static void EnsureSeeded(this PracticeContext context)
        {
            if (!context.Users.Any())
            {
                MockUsers.CreateUser(context);
            }

            MockActionState.ActionStateMock(context);

            MockUsersState.UsersStateMock(context);
            MockSuppliers.SupplierMock(context);
            MockItems.ItemsMock(context);
            MockSuppliersState.SupplierStateMock(context);
            MockOrders.OrderMock(context);

            MockItemsState.ItemsStateMock(context);


            MockOrdersState.OrdersStateMock(context);
        }